Package Exports
- @applicaster/zapp-react-native-utils/navigationUtils
- @applicaster/zapp-react-native-utils/navigationUtils/itemTypes
- @applicaster/zapp-react-native-utils/objectUtils
- @applicaster/zapp-react-native-utils/pluginUtils
- @applicaster/zapp-react-native-utils/reactUtils
- @applicaster/zapp-react-native-utils/reactUtils/createContext
- @applicaster/zapp-react-native-utils/stylesUtils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@applicaster/zapp-react-native-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Zapp React Native Utils
This package contains js utilities for the Quick Brick App
Contributing
- Follow the steps in the main README to set up the Zapp-React-Native repo, and run the app.
- add your folder or file
- import it with
import { utility } from "@applicaster/zapp-react-native-utils/utility";
API
React Utils
attachLifeCycleMethods = (lifecycleMethods: { [name]: method }) => (Component) =>
adds lifecycle methods to any React component (stateless or class). The appropriate method will be used depending on the type of the component. If the component is stateless, it will wrap it in a class before it adds the method to the Component's prototype.
Supports all React lifecycle methods except constructor
and static getDerivedStateFromProps
import { attachLifeCycleMethods } from "@applicaster/zapp-react-native-utils/reactUtils";
const MyComponent = props => (
<View>
<Text>I'm component</Text>
</View>
);
const lifeCycleDecorator = attachLifeCycleMethods({
componentDidMount() {
console.log("I'm mounted");
},
componentWillUpdate(nextProps, nextState) {
console.log("component will change", nextProps, nextState);
},
});
export const ComponentWithLifeCycleMethods = lifeCycleDecorator(MyComponent);