Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@native-base/icons
Advanced tools
This project was designed to make integration of icons in nativebase projects easier. It is a unified library which export icons and fonts for all the native and web platforms.
yarn add @native-base/icons
Add Fonts:
_document.js
import { default as NativebaseDocument } from "@native-base/next-adapter/document";
import fontsCSS from "@native-base/icons/FontsCSS"
class Document extends NativebaseDocument {
//
}
async function getInitialProps({ renderPage }) {
const res = await NativebaseDocument.getInitialProps({ renderPage });
const styles = [
// eslint-disable-next-line react/jsx-key
<style dangerouslySetInnerHTML={{ __html: fontsCSS }} />,
...res.styles
];
return { ...res, styles: React.Children.toArray(styles) };
}
Document.getInitialProps = getInitialProps;
export default Document;
_document.js
)
import { default as NativebaseDocument } from "@native-base/next-adapter/document";
import AntDesignFontFaceCSS from "@native-base/icons/FontsCSS/AntDesignFontFaceCSS";
import MaterialIconsFontFaceCSS from "@native-base/icons/FontsCSS/MaterialIconsFontFaceCSS";
const fontsCSS = AntDesignFontFaceCSS + MaterialIconsFontFaceCSS;
class Document extends NativebaseDocument {
//
}
async function getInitialProps({ renderPage }) {
const res = await NativebaseDocument.getInitialProps({ renderPage });
const styles = [
// eslint-disable-next-line react/jsx-key
<style dangerouslySetInnerHTML={{ __html: fontsCSS }} />,
...res.styles
];
return { ...res, styles: React.Children.toArray(styles) };
}
Document.getInitialProps = getInitialProps;
export default Document;
Update next.config.js
with this code (if you are using @native-base/next adapter):
const { withNativebase } = require("@native-base/next-adapter");
const path = require("path");
module.exports = withNativebase({
dependencies: ["@native-base/icons"],
nextConfig: {
webpack: (config, options) => {
config.module.rules.push({
test: /\.ttf$/,
loader: "url-loader", // or directly file-loader
include: path.resolve(__dirname, "node_modules/@native-base/icons"),
});
config.resolve.alias = {
...(config.resolve.alias || {}),
"react-native$": "react-native-web",
};
config.resolve.extensions = [
".web.js",
".web.ts",
".web.tsx",
...config.resolve.extensions,
];
return config;
},
},
});
Add Fonts:
index.jsx
:
import fontsCSS from "@native-base/icons/FontsCSS";
const style = document.createElement("style");
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText += fontsCSS;
} else {
style.appendChild(document.createTextNode(fontsCSS));
}
document.head.appendChild(style);
import AntDesignFontFaceCSS from "@native-base/icons/FontsCSS/AntDesignFontFaceCSS";
import MaterialIconsFontFaceCSS from "@native-base/icons/FontsCSS/MaterialIconsFontFaceCSS";
const fontsCSS = AntDesignFontFaceCSS + MaterialIconsFontFaceCSS;
const style = document.createElement("style");
style.type = "text/css";
if (style.styleSheet) {
style.styleSheet.cssText += fontsCSS;
} else {
style.appendChild(document.createTextNode(fontsCSS));
}
document.head.appendChild(style);
.babel.config.js
file in root directory:
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
[
"module-resolver",
{
alias: {
"@native-base/icons": "@native-base/icons/lib",
},
},
],
],
};
};
Now, let’s render an icon:
import { Entypo } from "@native-base/icons";
return <Icon as={Entypo} name="user"></Icon>;
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)FAQs
## **Table of Contents**
The npm package @native-base/icons receives a total of 776 weekly downloads. As such, @native-base/icons popularity was classified as not popular.
We found that @native-base/icons demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.