I saw Apple itself has a tool for swift to access external hardware trough the lighting cable. Is there a way in React Native to do the same and access external hardware data through a cable connection?
Is there a way to access External devices through lightning/usb-c cables in React Native?
Can not Resolve React Native Camera MLKit Dependencies
My app builds fine on Android Studio, it runs fine with react-native run-android
but when I try to generate the .apk
it fails with ./gradlew assembleRelease
command. I get the following error.
Error Message
* What went wrong:
Could not determine the dependencies of task ':react-native-camera:compileMlkitReleaseAidl'.
> Could not resolve all task dependencies for configuration ':react-native-camera:mlkitReleaseCompileClasspath'.
> Could not find com.google.firebase:firebase-ml-vision:12.0.1.
Required by:
project :react-native-camera
> Could not find com.google.firebase:firebase-ml-vision-face-model:12.0.1.
Required by:
project :react-native-camera
package.json
"react": "16.8.3",
"react-native": "0.59.10",
"react-native-camera": "^3.7.1",
"react-native-image-picker": "^0.28.1",
"react-native-qrcode-scanner": "^1.2.3",
gradle properties
classpath('com.android.tools.build:gradle:3.4.0') // FROM android/gradle.build
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip // FROM gradle-wrapper.properties
I have followed the installation instructions here and followed GitHub links here and here.
All have the same solution which I have completed, i.e. adding;
android/app/build.gradle
android {
defaultConfig {
missingDimensionStrategy 'react-native-camera', 'general'
}
}
Note
The issue is because android is looking for mlkit
dependencies even when I have not opted for them. I think this is happening because I use react-native-image-picker
and react-native-qrcode-scanner
one of these packages is looking mlkit dependencies. But I don't know how to debug and fix it.
Expo calendar event get removed on android if the timezone of device is change
I was working on expo calendar recently. I came across a problem that on ANDROID, whenever I create a new calendar event and change the timezone of the device, then the event is removed from the calendar.
Here are my configurations:
For calendar:
const newCalendar = {
title: 'Test',
entityType: Calendar.EntityTypes.EVENT,
color: 'red',
sourceId:
Platform.OS === 'ios'&&
calendars.find(
cal =>
(cal.source && cal.source.name === CALENDAR_SOURCE_IOS.DEFAULT) ||
(cal.source && cal.source.name === CALENDAR_SOURCE_IOS.I_CLOUD)
).source.id,
source: Platform.OS === 'android'&& {
name: calendars.find(cal => cal.accessLevel === Calendar.CalendarAccessLevel.OWNER).source
.name,
isLocalAccount: true,
},
name: 'Test',
accessLevel: Calendar.CalendarAccessLevel.OWNER,
ownerAccount:
Platform.OS === 'android'&&
calendars.find(cal => cal.accessLevel === Calendar.CalendarAccessLevel.OWNER).ownerAccount,Calendar.CalendarAccessLevel.OWNER).ownerAccount,
allowsModifications: false,
isVisible: true,
}
For Event:
const event = {
title: 'test event',
startDate: testStartDate,
endDate: testEndDate,
location: 'Test location',
timeZone: Localization.timezone,
endTimeZone: Localization.timezone,
}
The behavior on iOS on changing the timezone is: the event date is updated in calendar. (which is the expected behavior).
On Android: On changing the timezone of the device, the event is removed.
Building react native app fails on android licenses
I'm diving into react native world for first time and I'm trying to setup a Windows dev environment from scratch following this article. Everything is ok until I try running react-native run-android
. I've already accepted all licences with sdkmanager --licenses
but I still get licences errors:
> Configure project :app
Checking the license for package Android SDK Build-Tools 27.0.3 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Build-Tools 27.0.3 not accepted.
Checking the license for package Android SDK Platform 27 in C:\Program Files\Android\Android Studio\licenses
Warning: License for package Android SDK Platform 27 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-27 Android SDK Platform 27
build-tools;27.0.3 Android SDK Build-Tools 27.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
Alternatively, to transfer the license agreements from one workstation to another, see http://d.android.com/r/studio-ui/export-licenses.html
Then I found this comment where a user suggests the following command: $ANDROID_HOME/tools/bin/sdkmanager "build-tools;26.0.1""platforms;android-26"
. I executed it as sdkmanager.bat "platforms;android-27""build-tools;27.0.3"
to match the versions in my env and the manager did downloaded new licences, but the errors stays.
I don't know how to accept those licences above. Any suggestion?
Android BiometricPrompt DeviceCredentialHandler: onCreate: Executor and/or callback was null
It looks like BiometricPrompt 1.0.0 has a bug where it stays in invisible state throwing that exception
ill suggest a workaround in the answer
EDIT(thanks to @Isai Damier):
Way to reproduce:
- open the BiometricPrompt
- press back button - close the prompt
- press back again and exit the app
- return to the app - try to open the prompt again
React Native: onPress in Android side somehow triggers onNavigationStateChange
I have some code that I implemented a couple of months ago that fixed the ability for a user to who was reading an article on my app and wanted to click on a hyperlink inside that article, once having done so, the user would be taken to an external browser. This is the implementation:
<View style={styles.content}>
{Boolean(this.props.article.VideoID) && (
<VimeoVideo videoId={this.props.article.VideoID.toString()} />
)}
{Boolean(this.props.article.Summary) && (
<Text style={styles.boldParragraph}>
{this.props.article.Summary}
</Text>
)}
{this.props.article.Sections.map(s => (
<WebViewAutoHeight
key={s.Body.substr(10)}
source={{
//prettier-ignore
html: `<body style="font-family: -apple-system, Roboto, sans-serif; background-color: ${lightTheme.grey2} !important; color: ${v2Colors.charcoalDarkest}; font-size: ${moderateScale(14, 0.2)}px;">${s.Body}</body>`
}}
// onNavigationStateChange={event => {
// if (event.url !== uri) {
// Linking.openURL(event.url);
// }
// }}
/>
))}
</View>
The commented out part.
It works for iOS
but on Android, as soon as the user clicks on READ MORE, it takes them to open up another browser in their phone
not sure of the connection
because onPress={mainActionButtonPress}
is what the user is pressing
and mainActionButtonPress
is connected to a function:
_goto = article => {
this.props.setSelectedArticle(article);
this.props.navigation.navigate("ArticleDetails", { isRead: true });
};
how is onNavigationStateChange
property inside of AutoHeightWebView
being triggered by the _goto
function? So I looked into this further and my best guess is that when _goto
triggers this.props.navigation.navigate("ArticleDetails", { isRead: true });
, JavaScript executes everything inside of there including onNavigationStateChange
even though it should only do so when event.url !== uri
.
I was able to find a solution with:
onShouldStartLoadWithRequest={request => {
if (Platform.OS === "android") {
const url = request.url;
console.log(request);
if (url !== uri) {
Linking.openURL(url);
}
// return false;
}
}}
but then this somehow cancels out the iOS solution. So this is not working:
<WebViewAutoHeight
key={s.Body.substr(10)}
source={{
//prettier-ignore
html: `<body style="font-family: -apple-system, Roboto, sans-serif; background-color: ${lightTheme.grey2} !important; color: ${v2Colors.charcoalDarkest}; font-size: ${moderateScale(14, 0.2)}px;">${s.Body}</body>`
}}
// onShouldStartLoadWithRequest={request => {
// if (Platform.OS === "android") {
// const url = request.url;
// console.log(request);
// if (url !== uri) {
// Linking.openURL(url);
// }
// // return false;
// }
// }}
onNavigationStateChange={event => {
if (Platform.OS === "ios") {
if (event.url !== uri) {
Linking.openURL(event.url);
}
}
}}
/>
I tried a ternary operator, but I got syntax errors all over the place. I need some help in getting these working on their respective platforms.
I tried to see if I could just use onShouldStartLoadWithRequest
for both platforms, but iOS does not seem to recognize this property, because when I tested it, the articles on iOS do not show up at all in the WebView I just get a blank screen.
Unable to resolve module `scheduler/tracing` react native
i get some error like this in react-native run-android process
error: bundling failed: Error: Unable to resolve module `scheduler/tracing` from `/Users/miftahali/projects/react/appscustomec/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js`: Module `scheduler/tracing` does not exist in the Haste module map
this my Environment
React Native Environment Info:
System:
OS: macOS 10.14.2
CPU: (4) x64 Intel(R) Core(TM) i5-4260U CPU @ 1.40GHz
Memory: 38.67 MB / 4.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.0.0 - ~/.nvm/versions/node/v10.0.0/bin/node
npm: 5.6.0 - ~/.nvm/versions/node/v10.0.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
Android SDK:
API Levels: 19, 20, 23, 25, 26, 27
Build Tools: 23.0.1, 25.0.3, 26.0.1, 27.0.3, 28.0.3
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: ^0.57.8 => 0.57.8
npmGlobalPackages:
create-react-native-app: 1.0.0
How to resolve this ?, thanks
Weird behaviour with Double Tapping BottomTabNavigator - React Navigation
I use React Navigation to do my Navigation in my mobile app and I have a structure navigation like this:
const AccountStack = createStackNavigator(
{
Account: AccountView,
...
},
{
initialRouteName: 'Account',
headerMode: 'screen',
....
}
)
const SearchUsersStack = createStackNavigator(
{
SearchUsers: SearchUsersView,
UserProfile: UserProfileView,
FriendsOfUser: FriendsOfUserView
},
{
...
}
)
const AccountModalStack = createStackNavigator(
{
AccountStack: AccountStack,
SearchUsersStack: SearchUsersStack,
},
{
initialRouteName: 'AccountStack',
headerMode: 'none',
mode: 'modal',
}
)
const MainApp = createBottomTabNavigator(
{
MainHome: HomeStack,
MainPlay: PlayStack,
MainAccount: AccountModalStack
},
{
...
}
)
If I'm in the "search User" stack (for example, in SearchUserView) and I click on the "Account" icon in the bottom tab navigator, the stack will dismiss correctly and I will return to my "account" view.
However, if I am in one of the routes of my AccountStack and I click on the "Account" icon in the bottom tab navigator, the stack does not dismiss. So if I'm very far in the account stack, I have to go back with the back arrow.
Why does it work when I'm in the SearchUserStack but not when I'm in my AccountStack ?
I hope to find help!
Thank you !
Viktor
can't run react native with emulator android on Atom
i have an iphone and i don't have a macbook so i have to use an emulator android to test my application react-native
When I type the command : react-native run-android
I got 2 errors:
2- error sdk
Error #1 :
My emulator is open :
I use the Piexel 3L API 26 with Android 8.0 Pixel 3L
what more do i need to do?
Error #2 :
This is my path SDK : Path sdk
So in android studio i have the same path : Android studio path
And my path is in environment variables : Environnement variables path
thanks for wanting to help me.
Android : script in HTML can't call addEventListener when I setting shouldOverUriLoading return false
When I using react-native-webview, I have to set function shouldOverideUrlLoading return false. So that my script in HTML can't listen to the message I send from my Component. It worked fine in iOS but Android my function addEventListener in HTML doesn't trigger anything
My HTML javascript looks like:
console.log("checkme; data", data);
if (data.data) {
alert("checkMe:" + JSON.stringify(data.data));
symbol = data.data;
}
// initOnReady();
})
In my Component I fire postMessage to my WebView like this:
this.WebView.postMessage("hello");
In iOS, nothing wrong, but in Android, maybe shouldOverideUrlLoading stopping me to pass data from component to webview to update HTML file. So do you have another solution to pass data from component to webview, not by postMessage or I'm wrong in something? Please help me out
react-native-video [android] undefined is not an object (evaluating NativeModuels.UIManager.RCTVideo.Constants')
I integrated react native to an existing android app, I am trying to use react-native-video component for displaying video on the application.
- React-native: 0.42.0
- react-native-video: 1.0.0
I followed the instructions here: https://github.com/react-native-community/react-native-video
On the MainApplication.java I added this:
import com.brentvatne.react.ReactVideoPackage;
....
@Override
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactVideoPackage()
);
}
I added this to my settings.gradle (only one in app)
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android')
In my android/app/build.gradle
compile project(':react-native-video')
And on my react native component:
import Video from 'react-native-video';
....
render() {
return (
<View>
<Video source={{uri: 'https://vjs.zencdn.net/v/oceans.mp4'}} resizeMode="cover" repeat={true} />
....
The react native component builds correctly but end up showing this warning on a yellow screen and nothing else:
Possible Unhandled Promise Rejection (id: 0):
undefined is not an object (evaluating '_reactNative.NativeModules.UIManager.RCTVideo.Constants')
render@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:46677:73
http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12555:27
measureLifeCyclePerf@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12015:14
_renderValidatedComponentWithoutOwnerOrContext@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12554:45
_renderValidatedComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12575:78
performInitialMount@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12227:55
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12130:40
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
mountChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11615:56
initializeChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:9929:41
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:10012:28
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
performInitialMount@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12235:48
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12130:40
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
performInitialMount@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12235:48
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12130:40
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
performInitialMount@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12235:48
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12130:40
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
mountChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11615:56
initializeChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:9929:41
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:10012:28
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
performInitialMount@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12235:48
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:12130:40
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
mountChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11615:56
initializeChildren@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:9929:41
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:10012:28
mountComponent@http://localhost:8081/reactnative/wall.bundle?platform=android&dev=true&hot=false&minify=false:11170:49
performInitialMount@http://localhost:8081/reactnati
Thanks!
Is react native better over flutter [closed]
I have gone through both the technology, react and flutter, react looks a huge community over different plateform and flutter looks quite new for that, so could some one share their experience which should to pick.
ReactApplicationContext cannot be converted to AppCompatActivity
I am trying to create a Native module for an Android SDK. When I try to pass reactContext to it I get the following ReactApplicationContext cannot be converted to AppCompatActivity
. This is the block with error
try {
manager.sendPaymentRequest(apiKey,
hmac,
txn,paymentCallback,reactContext);
} catch (InvalidPaymentRequestException ipre){
// Do something with the exception
promise.reject("error ipre: "+ipre);
} catch (Exception e){
// Do something with the exception
promise.reject("error e: "+e);
}
I also tried passing getCurrentActivity()
instead of reactContext
but it gives error: incompatible types: Activity cannot be converted to AppCompatActivity
error. How can I pass AppCompatActivity in ReactNative. Also tried changing ReactNative MainActivity from ReactActivity to ReactFragment but there is no change. My React native version is 0.61.5 and Android API level is 28
use ExoPlayer in React Native
Hi I'm using react native, so I needed exoplayer to show subtitle on it in android.... I added exoplayer inside my app, after that should I do something to use exoplayer as default or it will link to react-native-video ? thanks
@firebase/firestore: Firestore (7.6.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
I am working on a React native project that is connected to cloud firestore and I am using the latest version of Firebase package ^7.6.1
, My Application is target both Android and iOS I tested the registration module through iOS and it works seamlessly with out problems when I tested it through Android Emulator (Google pixel 2) with Android version 9 Authentication works with out any problems but fetching data from any collection not working at all resulting in the following error:
[2019-12-31T09:25:11.274Z] @firebase/firestore: Firestore (7.6.0): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
I have spent a day trying to figure out where might be the problem and I found the following thread: https://github.com/firebase/firebase-js-sdk/issues/283
But as noted "The original issue with xhr.send() on Android that this bug was tracking has been resolved in the March React Native release (0.55.0)." It's obvious that the issue is now resolved.
I found this question also:
Call to firestore collection() not working on expo
but I have to downgrade to an old version of Firebase 4.6.2
that for sure have many dependencies that is deprecated.
Here is my code sample:
try {
const response = await firebase.auth().signInWithEmailAndPassword(email, password);
const document = await firebase.firestore().collection('users').doc(response.user.uid).get();
props.navigation.navigate('AppMain');
} catch (error) {
console.log(error);
}
Here is Security Rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Extended the expire date
// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
match /{document=**} {
allow read, write: if true;
}
}
}
Do I miss something here? and If I have to deattach from Expo and use React Native Firebase package instead.
Value for title can not be cast from ReadablenativeMap to string
InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat("" , pinValue2);
var String_4 = String_3.concat("" , pinValue3);
var String_5 = String_4.concat("" , pinValue4);
fetch("http://www.aonde.biz/mobile/doLogin.php", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"pin":212,
})
})
.then(response => response.json())
.then(responseJson => {
// Showing response message coming from server after inserting records.
Alert.alert(responseJson);
})
.catch(error => {
console.error(error);
});
In the above code when I pass pin parameter API then show this error. Thank you please give some idea how to resolve this issue.
How can I run react native application in widnows 10?
I am trying to learn react nattive.
I have windows 10 machine.
Hyper -v Is not supported.
So When I try to run my android application using react-native run-android
I am getting the following error in console
Failed to launch emulator. Reason: Emulator exited before boot..
Also my command show loading dependecny graph, doen
How can I fix the Error and make Android Emulator Works in windows 10 ?
If I run emualtor from Android Studio
How to customize within Expo SDK36 the Android Splash screen without any background color flickering?
Description
I am building a react-native
app with expo SDK36
.
I want to configure to make a nice splash screen without animation for the moment (using a .png
)
Reproduction
- Init a blank expo project:
expo init # choose blank project
- Edit
app.json
with:
{
+ "backgroundColor": "#FF5454",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover"
}
}
- Use the
AppLoading
template on expo documentation, mine look like this:
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
isSplashReady: false,
isAppReady: false,
};
}
_cacheSplashResourcesAsync = async () => {
const gif = require('../assets/splash.png');
return Asset.fromModule(gif).downloadAsync();
};
_cacheResourcesAsync = async () => {
SplashScreen.hide();
const images = [
require('../assets/homepage/a-basket-of-apples-in-an-outdoor-market.jpg'),
require('../assets/homepage/available-at-google-play.png'),
require('../assets/homepage/available-at-app-store.png'),
];
try {
await Font.loadAsync({
'raleway-medium': require('../assets/fonts/Raleway-Medium.ttf'),
roboto: require('../assets/fonts/Roboto-Regular.ttf'),
});
} catch (e) {
// we have found that Safari on iPhone 6 was failing even if fonts are loaded
}
const cacheImages = images.map((image) => Asset.fromModule(image).downloadAsync());
await Promise.all(cacheImages);
this.setState({ isAppReady: true });
};
render() {
const { isSplashReady, isAppReady } = this.state;
if (!isSplashReady) {
return (
<AppLoading
startAsync={this._cacheSplashResourcesAsync}
onFinish={() => this.setState({ isSplashReady: true })}
onError={process.env.NODE_ENV === 'production' ? undefined : console.warn /* eslint-disable-line no-console */}
autoHideSplash={false}
/>
);
}
return (
<View style={{ flex: 1 }}>
{!isAppReady ? (
<Image
source={require('../assets/splash.png')}
onLoad={this._cacheResourcesAsync}
/>
) : (
<AppCore
version={`${version}-${getEnvVars().name}`}
locales={locales}
backgroundImage={require('../assets/homepage/a-basket-of-apples-in-an-outdoor-market.jpg')}
/>
)}
</View>
);
}
}
- Run
expo start --android
Expected
I expect to have a nice splash.png
displayed when opening my app, and instant transition to the view.
Result
Instead the splash.png
disappears with an instant screen flickering that uses the color of the background color set in app.json
(0ms transition, very ugly).
It then disappears quickly with a fade out.
Related issues
These are related issues I have created:
Importing react native app from github and questions for the brave [closed]
I wanted to review one of the showcase application from react native [github library][1], and instead I wasted all day trying to debug errors and install modules and jdk, moving from one error to another.
So I just have a few question for the people here who got the hang of it:
Why when I run npm start it opens up metro bundler at 8081? Is it like expo, where I can connect through wifi or they just show of they can use network?
Running the app on my device seemed tedious so I run Android Emulator -> cmd: react-native run-android and I got error after error* during the build process. Is it really how things suppose to be? It's a project on their official github, I did nothing else besides the instructions on their website and I get uninformatic isoteric errors.
What is the correct way to import and play react-native project from your experience?
*Latest one was Execution failed for task ':react-native-fast-image:compileDebugJavaWithJavac'.
Thank you.
FLAG_ACTIVITY_NEW_TASK error integrating android native library in react native
I'm trying to integrate a native payment library in a react native application.
The library requires an view setup like this to process the pay result.
The library raises next error
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
I don't know if my configuration is wrong, the native library demo application works fine. :( The pay response intent tries load the activity but apparently it can't find it.
Update
The library function that fails is:
String appId = context.getPackageName() + "." + callbackSchema;
Intent intent = new Intent(appId);
intent.putExtra(ConstantUtil.RETURNED_JSON_KEY,json);
context.startActivity(intent); // <- this call raises the error
Update Finally I made it work. I was passing context like that:
getReactApplicationContext()
I solved it passing context like that:
getCurrentActivity()
In debug, I got this values:
but the error still raising :(
Any idea?