$ npm install react-native-ant-viewer
If you use Cocoapods:
- Add
pod 'RNAntViewer', path: '../node_modules/react-native-ant-viewer'
to your Podfile $ pod install
If not:
$ pod init
platform :ios, '11.3'
use_frameworks!
target 'your_app_name' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'RNAntViewer', path: '../node_modules/react-native-ant-viewer'
end
$ pod install
import AntWidget from 'react-native-ant-viewer';
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<AntWidget
isLightMode={true}
bottomMargin={40}
rightMargin={30}
onViewerAppear={() => console.log("Appeared")}
onViewerDisappear={() => console.log("Disappeared")}
/>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
Property | Type | Description |
---|---|---|
isLightMode | Bool | There are two widget appearance modes: light & dark. By default false. |
bottomMargin | Number | Bottom margin. Default: 20. |
rightMargin | Number | Right margin. Default: 20. |
onViewerAppear | Callback | Called when the user opens the widget controller. |
onViewerDisappear | Callback | Called when the user dismisses the widget controller. |
Mykola Vaniurskyi, [email protected]
RNAntViewer is available under the MIT license. See the LICENSE file for more info.