Closed mindaugasnakrosis closed 3 years ago
I have never used expo before but I gave it a try...
I ran through the instructions at https://docs.expo.io/bare/exploring-bare-workflow/ to spin up a new expo app. You need to use the "bare workflow" as this app has native Android code (Intents)
I ran react-native-unimodules
but I'm not certain if that was necessary
Then yarn add react-native-datawedge-intents
as you had done
Then modified App.js as follows:
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import DataWedgeIntents from 'react-native-datawedge-intents';
export default function App() {
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<StatusBar style="auto" />
<TouchableOpacity
onPress={() => DataWedgeIntents.sendBroadcastWithExtras({
action: "com.symbol.datawedge.api.ACTION",
extras: {"com.symbol.datawedge.api.SOFT_SCAN_TRIGGER":"START_SCANNING"}})}
style={{ backgroundColor: 'blue' }}>
<Text style={{ fontSize: 20, color: '#fff' }}> Emit Beam </Text>
</TouchableOpacity>
</View>
);
}
Then yarn android
to run it. The scanner beam will emit when you press the button which shows that in principle this should work.
Thanks for a quick answer, looks like initialising expo with bare project type fixes the issue.
I just bought a Zebra TC21 phone and I am trying to implement DataWedge intents into my application on it. Using expo and tried running commands:
I get a warning:
However, I believe it links anyway. Then I run
expo start --android
which runs android react-native application on my connected device.Then I get an error:
TypeError: null is not an object (evaluating 'RNDataWedgeIntents.ACTION_SOFTSCANTRIGGER')
It might be a problem with expo, so I tried running:
yarn react-native run-android
It doesn't recognise that this is an android project:
error Android project not found. Are you sure this is a React Native project?. Run CLI with --verbose flag for more details.
Any suggestions what I should try? This looked like a similar issue as https://github.com/darryncampbell/react-native-datawedge-intents/issues/3.
However I am not using create-react-app.
I am using
React Native 0.61