react-native-zalo
Cài đặt thư viện
$ npm install --save react-native-zalo
$ yarn add react-native-zalo
Cài đặt Zalo SDK
Thêm câu bên dưới vào script object ở file package.json
"scripts": { ... "zalo": "chmod +x node_modules/react-native-zalo/scripts/setup.sh && node_modules/react-native-zalo/scripts/setup.sh RNZaloExample"}
Chạy câu lệnh npm run zalo
hoặc yarn zalo
để cài đặt Zalo SDK
Code ví dụ
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ ;; ; const instructions = Platform; type Props = {};<Props> { // BẮT BUỘC PHẢI SET ZALO APP ID TRƯỚC TIÊN RNZalo; // RỒI SAU ĐÓ MUỐN LÀM GÌ LÀM RNZalo; } { console; }; { console; }; { return <View style=stylescontainer> <Text style=styleswelcome> Welcome to React Native! </Text> <Text style=stylesinstructions> To get started edit Appjs </Text> <Text style=stylesinstructions> instructions </Text> </View> ; } const styles = StyleSheet;