![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@native-base/icons
Advanced tools
Readme
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 762 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.