Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all 28469 articles
Browse latest View live

React Native Navigation Stack Navigator Back Button Displayed Incorrectly on Android

$
0
0

The Problem I have can be shown in the following GIF:

enter image description here

As you may notice, when I select the Back Button from the Stack Navigator, this weird bug appears, where the width of the back button seems to be too high.I wasn't able to fix this with the headerBackTitleStyle option.

This is my code:

export const AccountStackNavigation = () => (<Stack.Navigator initialRouteName="Account"><Stack.Screen      name="Account"      component={AccountPage}      options={({navigation}) => ({        headerRight: () => (<TouchableOpacity            onPress={() => navigation.navigate('Settings')}            style={globalStyles.borderRadius}><UilCog size={Typography.TITLE_1} color={Colors.TEXT_PRIMARY} /></TouchableOpacity>        ),        headerRightContainerStyle: globalStyles.stackContainer,        headerTitleAlign: 'center',      })}></Stack.Screen>    // here's the settings stack screen where the problem occurs<Stack.Screen      name="Settings"      component={SettingsPage}      options={{        headerBackTitleVisible: true,        headerBackTitle: 'Done',        headerTitleAlign: 'center',      }}></Stack.Screen></Stack.Navigator>);

I was sadly unable to find a similar problem online, so my guess would be that something with my code isn't right?

Also something to note; It works perfectly find on IOS. A possibile solution would be of course, that I write a back button from scratch for Android, however I am hoping on a better solution.


React Native Picker moves back to first item after scrolling and do not select correct value

$
0
0

I'm working with Picker component from React Native and I'm having some issues.

I'm trying to make a product registration page where each product has a catalog, so I'm using a Picker to show all catalogs that have been registered in the application. But, when I scroll the picker, it moves back to first item and when I press the button to registrate a product, I have the catalog field with undefined value. I'm using Formik for it.

Picker component:

<Picker                style={{ height: 10, width: 325 }}                value={this.state.selectedValue}                mode="dropdown"                itemStyle={{                  backgroundColor: '#F6F6F6',                  color: 'black',                  height: 120,                  marginTop: 25,                  fontFamily: 'Ebrima',                  fontSize: 17,                  borderRadius: 5,                  borderColor: '#7e2f89',                }}                             onValueChange={this.optionChanged}>                {this.state.catalogs.map((member, key) => {                  return (<Picker.Item                      label={member.name}                      value={member.name}                      key={key}                    />                  );                })}</Picker>

State and optionChanged:

 state = {    catalogs: [],    selectedValue: '',  };  optionChanged = value => {    console.log(value);    this.setState({ selectedValue: value});  };

Formik with initial values:

<Formik        initialValues={{          name: '',          description: '',          costPrice: '',          salePrice: '',          catalog: '',          amountStock: '',        }} ...

How can I make it work properly?

Thank you in advance!

Appcenter Codepush integration. Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists

$
0
0

Steps to Reproduce

  1. yarn add react-native-codepush
  2. Add following to android/app/build.gradle
apply from: "../../node_modules/react-native/react.gradle"apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
  1. Add following to MainApplication.java
...import com.microsoft.codepush.react.CodePush;...        @Override        protected String getJSBundleFile() {            return CodePush.getJSBundleFile();        }
  1. Add the following to strings.xml
<string name="CodePushDeploymentKey" moduleConfig="true">MYKEY</string>

Expected Behavior

Build should be successful

Actual Behavior

What actually happens?

 $ react-native run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 998 file(s) to forward-jetify. Using 4 workers...info JS server already running.info Installing the app...> Configure project :appWARNING: BuildType(debug): resValue 'react_native_dev_server_port' value is being replaced: 8081 -> 8081WARNING: BuildType(debug): resValue 'react_native_inspector_proxy_port' value is being replaced: 8081 -> 8081WARNING: BuildType(release): resValue 'react_native_dev_server_port' value is being replaced: 8081 -> 8081WARNING: BuildType(release): resValue 'react_native_inspector_proxy_port' value is being replaced: 8081 -> 8081Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warningsFAILURE: Build failed with an exception.* Where:Script '/Users/user/Desktop/project/app/native/node_modules/react-native/react.gradle' line: 118* What went wrong:A problem occurred configuring project ':app'.> Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4serror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* Where:Script '/Users/user/Desktop/project/app/native/node_modules/react-native/react.gradle' line: 118* What went wrong:A problem occurred configuring project ':app'.> Cannot add task 'bundleDebugJsAndAssets' as a task with that name already exists.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4s    at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)    at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)    at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

  • react-native-code-push version: ^6.2.1
  • react-native version: 0.62.2
  • iOS/Android/Windows version: unknown
  • Does this reproduce on a debug build or release build? only checked on debug
  • Does this reproduce on a simulator, or only on a physical device? build error

External SDKs

I do have an external SDK in build.gradle. I don't know if that is the reason for this error.

buildscript {    repositories {        maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal    }    dependencies {        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'    }}apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'apply plugin: "com.android.application"apply from: "../../node_modules/react-native/react.gradle"apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"....apply plugin: 'com.google.gms.google-services'

What I tried.

I moved two declarations to the bottom of app/build.gradle. but the error remains same

// puts all compile dependencies into folder libs for BUCK to usetask copyDownloadableDepsToLibs(type: Copy) {    from configurations.compile    into 'libs'}apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)apply from: "../../node_modules/react-native/react.gradle"apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

Some article state to remove the line apply from: "../../node_modules/react-native/react.gradle". But New error is

yarn run v1.22.4$ react-native run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 998 file(s) to forward-jetify. Using 4 workers...info JS server already running.info Installing the app...Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warningsFAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:mergeDebugAssets'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not resolve project :react-native-code-push.     Required by:         project :app> Unable to find a matching configuration of project :react-native-code-push:          - None of the consumable configurations have attributes.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 3serror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:mergeDebugAssets'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not resolve project :react-native-code-push.     Required by:         project :app> Unable to find a matching configuration of project :react-native-code-push:          - None of the consumable configurations have attributes.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 3s    at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)    at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)    at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I removed both line (which actually don't make any sense) the error is

yarn run v1.22.4$ react-native run-androidinfo Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 998 file(s) to forward-jetify. Using 4 workers...info JS server already running.info Installing the app...Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warningsFAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.> Could not resolve project :react-native-code-push.     Required by:         project :app> Unable to find a matching configuration of project :react-native-code-push:          - None of the consumable configurations have attributes.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4serror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.> Could not resolve project :react-native-code-push.     Required by:         project :app> Unable to find a matching configuration of project :react-native-code-push:          - None of the consumable configurations have attributes.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4s    at makeError (/Users/user/Desktop/project/app/native/node_modules/execa/index.js:174:9)    at /Users/user/Desktop/project/app/native/node_modules/execa/index.js:278:16    at processTicksAndRejections (internal/process/task_queues.js:97:5)    at async runOnAllDevices (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)    at async Command.handleAction (/Users/user/Desktop/project/app/native/node_modules/@react-native-community/cli/build/index.js:186:9)error Command failed with exit code 1.info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

"Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0." -REACT-NATIVE

$
0
0

I am facing this error when I am trying to run a react-native application react-native run-android, I am unable to install the application. I am trying to build a camera application. My current react-native version:0.62.0, React-cli version : 2.0.1.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warningsFAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:mergeDebugAssets'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not resolve project :react-native-camera.     Required by:         project :app> Cannot choose between the following variants of project :react-native-camera:          - generalDebugRuntimeElements          - mlkitDebugRuntimeElements        All of them match the consumer attributes:          - Variant 'generalDebugRuntimeElements' capability camera2:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.                  - Found react-native-camera 'general' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.          - Variant 'mlkitDebugRuntimeElements' capability camera2:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.                  - Found react-native-camera 'mlkit' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 25serror Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* What went wrong:Could not determine the dependencies of task ':app:mergeDebugAssets'.> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.> Could not resolve project :react-native-camera.     Required by:         project :app> Cannot choose between the following variants of project :react-native-camera:          - generalDebugRuntimeElements          - mlkitDebugRuntimeElements        All of them match the consumer attributes:          - Variant 'generalDebugRuntimeElements' capability camera2:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'generalDebug' but wasn't required.                  - Found react-native-camera 'general' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.          - Variant 'mlkitDebugRuntimeElements' capability camera2:react-native-camera:unspecified:              - Unmatched attributes:                  - Found com.android.build.api.attributes.VariantAttr 'mlkitDebug' but wasn't required.                  - Found react-native-camera 'mlkit' but wasn't required.              - Compatible attributes:                  - Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.                  - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value'Aar'.                  - Required org.gradle.usage 'java-runtime' and found compatible value 'java-runtime'.* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 25s    at makeError (C:\MyAssignments\camera2\node_modules\execa\index.js:174:9)    at C:\MyAssignments\camera2\node_modules\execa\index.js:278:16    at processTicksAndRejections (internal/process/task_queues.js:93:5)

I tried cd Android && gradlew clean --warning-mode=all -- stacktrace and I was pointed out to this. I tried to find the BuildListener in gradle.build but I didn't find it. How to Remove this BuildListener? so that I can run my code.

> Configure project :appBuildListener#buildStarted(Gradle) has been deprecated. This is scheduled to be removed in Gradle 7.0.        at org.gradle.invocation.DefaultGradle.nagBuildStartedDeprecationIfOverriden(DefaultGradle.java:406)        at org.gradle.invocation.DefaultGradle.addBuildListener(DefaultGradle.java:399)        at com.android.build.gradle.internal.BuildSessionImpl.initialize(BuildSessionImpl.java:156)        at com.android.build.gradle.internal.PluginInitializer.initialize(PluginInitializer.java:88)        at com.android.build.gradle.BasePlugin.basePluginApply(BasePlugin.java:236)        at com.android.build.gradle.BasePlugin.lambda$apply$0(BasePlugin.java:217)        at com.android.build.gradle.internal.crash.CrashReporting.runAction(crash_reporting.kt:27)        at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:215)        at com.android.build.gradle.BasePlugin.apply(BasePlugin.java:119)        at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:43)        at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:51)        at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:181)        at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51)        at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:276)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:159)        at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:156)        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:49)        at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:156)        at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:136)        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyType(DefaultObjectConfigurationAction.java:162)        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:41)        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:96)        at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:185)        at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:49)        at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.java:37)        at org.gradle.api.Script$apply$0.callCurrent(Unknown Source)        at build_4e1gstckomspls8gdqvk8k9pp.run(C:\MyAssignments\Camera\android\app\build.gradle:1)        at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:91)        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl$2.run(DefaultScriptPluginFactory.java:237)        at org.gradle.configuration.ProjectScriptTarget.addConfiguration(ProjectScriptTarget.java:77)        at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:242)        at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)        at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)        at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:49)        at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)        at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:45)        at org.gradle.internal.Factories$1.create(Factories.java:26)        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:212)        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:193)        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:42)        at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)        at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:35)        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:107)        at org.gradle.internal.Factories$1.create(Factories.java:26)        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:238)        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:232)        at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:193)        at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:96)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:68)        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:699)        at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:142)        at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:36)        at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:64)        at org.gradle.configuration.DefaultProjectsPreparer.prepareProjects(DefaultProjectsPreparer.java:61)        at org.gradle.configuration.BuildOperatingFiringProjectsPreparer$ConfigureBuild.run(BuildOperatingFiringProjectsPreparer.java:52)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)        at org.gradle.configuration.BuildOperatingFiringProjectsPreparer.prepareProjects(BuildOperatingFiringProjectsPreparer.java:40)        at org.gradle.initialization.DefaultGradleLauncher.prepareProjects(DefaultGradleLauncher.java:204)        at org.gradle.initialization.DefaultGradleLauncher.doClassicBuildStages(DefaultGradleLauncher.java:142)        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:130)        at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:110)        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:60)        at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:57)        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:85)        at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:78)        at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)        at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)        at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:78)        at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:57)        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:31)        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)        at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:63)        at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)        at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:51)        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:45)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)        at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)        at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)        at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:50)        at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)        at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)        at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)        at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)        at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)        at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)        at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)        at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)        at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)        at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:68)        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:27)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)        at org.gradle.util.Swapper.swap(Swapper.java:38)        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)        at java.lang.Thread.run(Thread.java:748)

WebRTC using React Native or Android

$
0
0

I want to build a WebRTC mobile application for audio/video calling. React Native, Flutter or Android can be the solution. The WebRTC module for React Native and Android are available on GitHub. As React Native components interact with native APIs using JavaScript. My only concern is will React Native API calls cause a lag/delay in audio/video calling as compared to building application in Android. Will an application built on Android has a better performance than React Native application. Can anyone please guide what should I choose for building a WebRTC application using React Native or Android.

React-Native run-android command issue

$
0
0

When starting android project with React-Native it is giving this error:

React-Native Command run-android unrecognized.Did you mean to run this inside a react-native project?

Android failed to load JS bundle

$
0
0

I'm trying to run AwesomeProject on my Nexus5 (android 5.1.1).

I'm able to build the project and install it on the device. But when I run it, I got a red screen saying

Unable to download JS bundle. Did you forget to start the development server or connect your device?

In react native iOS, I can choose to load jsbundle offline. How can I do the same thing for Android? (Or at least, where can I configure the server address?)

Update

To run with local server, run the following commands under your react-native project root directory

  1. react-native start > /dev/null 2>&1 &
  2. adb reverse tcp:8081 tcp:8081

please take a look at dsissitka's answer for more details.

To run without a server, bundle the jsfile into the apk by running:

  1. create an assets folder under android/app/src/main
  2. curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

please take a look at kzzzf's answer for more details.

Why don't runnig my react-native project?

$
0
0

I download Material Kit React Native

According to the instructions I installed

removed dependencies
removed react-navigation@3.11.0

Added dependencies
added @react-navigation/compat@5.0.0
added @react-navigation/drawer@5.0.0
added @react-navigation/native@5.0.0
added @react-navigation/stack@5.0.0
added @react-native-community/masked-view@0.1.5
added react-native-reanimated@1.4.0
added react-native-safe-area-context@0.6.0
added react-native-screeens@2.0.0-alpha.12


but that can't runnig my project.

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.Jetifier found 1126 file(s) to forward-jetify. Using 8 workers...info Starting JS server...info Installing the app...> Task :react-native-screens:javaPreCompileDebug FAILEDDeprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.Use '--warning-mode all' to show the individual deprecation warnings.See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings43 actionable tasks: 2 executed, 41 up-to-dateFAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':react-native-screens:javaPreCompileDebug'.> Could not resolve all files for configuration ':react-native-screens:debugCompileClasspath'.> Could not find coordinatorlayout.jar (androidx.coordinatorlayout:coordinatorlayout:1.0.0).     Searched in the following locations:         https://dl.google.com/dl/android/maven2/androidx/coordinatorlayout/coordinatorlayout/1.0.0/coordinatorlayout-1.0.0.jar* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4serror Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':react-native-screens:javaPreCompileDebug'.> Could not resolve all files for configuration ':react-native-screens:debugCompileClasspath'.> Could not find coordinatorlayout.jar (androidx.coordinatorlayout:coordinatorlayout:1.0.0).     Searched in the following locations:         https://dl.google.com/dl/android/maven2/androidx/coordinatorlayout/coordinatorlayout/1.0.0/coordinatorlayout-1.0.0.jar* Try:Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.* Get more help at https://help.gradle.orgBUILD FAILED in 4s    at checkExecSyncError (child_process.js:621:11)    at execFileSync (child_process.js:639:15)    at runOnAllDevices (D:\React native projects\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)    at buildAndRun (D:\React native projects\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)    at D:\React native projects\AwesomeProject\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12    at processTicksAndRejections (internal/process/task_queues.js:85:5)    at async Command.handleAction (D:\React native projects\AwesomeProject\node_modules\react-native\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)

Video compression for a social media site

$
0
0

I am trying to create a social media site. I am using React Native (Andriod) for the frontend, and Spring framework and MySQL for the backend. We provide video uploading on my website. I was wondering where I should compress this data (frontend/React Native or backend/Spring Framework). Also, I am wondering which video compression library I should use as well.

Direct print from React Native to Zebra ZQ520

$
0
0

I'm currently trying to print from my React Native app to a Zebra ZQ520 portable printer. I have been able to print using a 3rd party print service, but part of the problem is I also need this to direct print (silent print) as I want to avoid the Android print preview screen.

I'm using Expo for development so this adds another issue as a lot of the libraries cannot be used without first ejecting from Expo. This is something that I can do if need be, but right now I'm just trying to find the best solution to this problem.

So far I have printed through the 3rd party print service by calling Expo's Print.printAsync(options) and passing through HTML but again, this only serves to call the android print preview screen which I'm trying to avoid. I've also looked at PDF direct from Zebra (https://www.zebra.com/us/en/support-downloads/printer-software/pdf-virtual-device.html) which shows some promise as you can also use Expo's Print.printToFileAsync() to save to .PDF format. With this option I just currently haven't found if it's possible to use PDF direct from an Android device.

The thought I had with ejecting was using the react-native BLE PLX package (https://github.com/Polidea/react-native-ble-plx) to handle the direct connection with the Zebra printer and send raw CPCL commands to the printer. The issue this seemed to raise was the limitations in terms of any images that may need to be printed.

I'm very new to React and up until now I've never had to work with hardware either so I'm trying to learn as I go. If anyone can point me in the right direction it would be appreciated.

React Native - Disable soft keyboard permanently on Android

$
0
0

Is it possible not to show the soft keyboard even when the TextInput gets focused? My use case is that I need to hide the keyboard completely (for example like when you use some external keyboard) but I need to retain focus on the TextInput so I can use it normally (see the caret and so).

I don't like hacking libs, but I looked inside the textinput folder in the react-native package and found some files which I thought could be relevant. First this one:

https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L96

I replaced the code on line 96 with this:

editText.setInputType(InputType.TYPE_NULL);editText.setTextIsSelectable(true);

but unfortunately it didn't work.

Then I found this file:

https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java#L215

And commented out the line 215, but again, it didn't help.

Could anybody point me in a correct direction about how to get this done? Thanks.

Which is the best way to communicate from app to app in single device?

$
0
0

My idea is create Report Viewer application for both Android and IOS, (could be good on ReactNative also)

  1. BaseApp: open ReportApp via URL_Scheme to register BaseApp URL_Scheme
  2. ReportApp: send request to get json_spec to BaseApp
  3. ReportApp: read api from spec, and send request back to BaseApp get and display data (table, chart,...)

I find some technologies, that I think it could solve my problem:

  1. Inter Process Communication
  2. Android Intent
  3. Android Content Provider
  4. Or, May I use custom REST server on my app

"error: not implemented" when importing and using ipfs-http-client in React native

$
0
0

I tried to import and use the "ipfs-http-client" in my react native code.However, I got the following error: "error: not implemented.

package.json:"ipfs-http-client": "^42.0.0", "node-libs-react-native": "^1.2.0", "react": "16.11.0", "react-native": "0.62.2",

Is problem related to upgrading/downgrading "ipfs-http-client"? Has anyone faced this problem before ?

Any help would be highly appreciated.

react-native how multiple scrollview can be synchronized

$
0
0

react-native synchronous movement of 5 of scrollView .how do you ı sync.

<ScrollView horizontal ref={scrolListRef}                        onScrollEndDrag={(e) =>                            //ref get xcoordvalue//scrollListRef map into ref xcoord asssigment                         }                        pagingEnabled                        scrollEventThrottle={16}>

onScroll : leads to an endless loop onScrollEndDrag:it creates a delay problem

react native - collapse table

$
0
0

I plan to make a collapse table. You can find it in this link

I tried:

  • Using a Custom Component for column name and FlatList for the first column
  • Using Section list for the rest column

=============================================================
| _____Custom Component_____ | __________Section list header__________ |
|============================================================|
| _________Flat List___________| __________ Section list body____________|
|============================================================|

I am able to make the list scroll together. However, if the list has 450+ rows, the performance will be reduced dramatically.

Please let me know if you have any solution.

Thank you in advanced!


TypeError: undefined is not an object (evaluating 'l.default.manifest.android.config.googleMaps')

$
0
0

I've published and buid Expo app using expo publish and expo build:android. But React native maps not working on Android standalone app. App is crashing and not rendering any maps on screen.

Sentry shows this error:

TypeError: undefined is not an object (evaluating 'l.default.manifest.android.config.googleMaps')at Ul([native code])at Pl([native code])at callImmediates([native code])at value([native code])at value([native code])

Issue link: https://sentry.io/share/issue/b1cd2b27557d4d1d8f35a9ef1596188d/

Sample code:

<MapView    ref={mapViewRef}    style={styles.map}    provider={PROVIDER_GOOGLE}    region={region}        scrollEnabled={true}    zoomEnabled={true}    pitchEnabled={true}    rotateEnabled={true}    showsUserLocation={true}    followsUserLocation={true}    showsMyLocationButton={false}    showsCompass={false}>      {markers.map(marker => renderMarker(marker))}      {isRenderRoute && route.origin && route.destination && renderRoute()}</MapView>

EnvironmentSystem:OS: WINDOWS 10node: 10.16.0npm: 6.14.4yarn: 1.22.4npmPackages:"expo": "~37.0.3","react": "~16.9.0","react-dom": "~16.9.0","react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz","react-native-maps": "0.26.1",

Platform: ANDROID SDK 27

app.json:

{"expo": {"name": "digidirectory","slug": "digi-directory","platforms": ["ios","android"    ],"version": "1.0.0","orientation": "portrait","primaryColor": "#27d8a1","icon": "./assets/icon.png","splash": {"image": "./assets/splash.png","resizeMode": "contain","backgroundColor": "#ffffff"    },"updates": {"fallbackToCacheTimeout": 0    },"assetBundlePatterns": ["**/*"    ],"facebookAppId": "584981585556234", "androidStatusBar": {"hidden": false,"translucent": false,"backgroundColor": "#23c290","barStyle": "light-content"    },"ios": {"bundleIdentifier": "com.digipakistan.digitaldirectory","buildNumber": "1.0.0","supportsTablet": true,"infoPlist": {"UIBackgroundModes": ["location","fetch"        ]      }    },"android": {"package": "com.digipakistan.digitaldirectory","versionCode": 1,"backgroundColor": "#ffffff","icon": "./assets/icon.png","adaptiveIcon": {"foregroundImage": "./assets/icon.png","backgroundColor": "#ffffff"      },"permissions": ["ACCESS_COARSE_LOCATION","ACCESS_FINE_LOCATION","CAMERA","WRITE_CONTACTS","WRITE_EXTERNAL_STORAGE"      ],"googleServicesFile": "./google-services.json","config": {"googleSignIn": {"apiKey": "AIzaSyCdI*********E594nPXik-ase_H9T0","certificateHash": "34a41f29d***********5ad33beea00873037ba2443"        },"googleMaps": {"apiKey": "AIzaSyBTpXf**********Qe8Siai77JIVXQMmUc"        }      }    },"description": "Digital Directory app, Release: 1.0.0","hooks": {"postPublish": [        {"file": "sentry-expo/upload-sourcemaps","config": {"organization": "tutors-house","project": "digi-directory","authToken": "73057c6f94**********2b8aaff78f2aac6b194987863f2df94256bd6b"          }        }      ]    }  }}

Help me please. I'm stuck and really confused.thanks


React Native Axios upload image return Network Error on Android

$
0
0

I tried to upload some data including an image to server using Axios.

It's working perfectly on iOS, but on Android, it returned Network Error

const data = new FormData();        data.append('tag', tag.METHOD_TAG_UPLOAD_PHOTO);        data.append('app_version', 1);        data.append('os_type', tag.OS_TYPE);        data.append('store_code', kodetoko);        data.append('photo', {            uri: image_picked.uri,            type: 'image/jpeg',            name: judul +".jpg"        });

I tried to search for solution elsewhere, they said that the problem is within the type of the photo's object, it needs to use image/jpeg type. I'm using it but it still return Network Error. Please help.

Function AsyncStorage in ComponentWillMount() don't execute before this render in React Native

$
0
0

I want change my state 'entree' before render with a function asyncstorage for change color button when i reset page. But this problem its my function _getData don't work in componentwillmount but after this render.I try to take of 'await' in my function _getData that its working my function runs just before the render but he don't return true or false, he return [object , Object].if you need more detail call me thx.Can you help me pls.

My code :

    constructor(props) {        super(props)        this.state = {             entree: true,            colorButton: null,            icoButton: null,        }        console.log("constructeur")    }     _getData = async () => {        try {            const value = await AsyncStorage.getItem('en')             if (value !== null) {                this.setState({                     entree: JSON.parse(value),                    loading : 'true',                })                console.log("Donnée recupéré : "+ value)            }        }catch(e) {            console.log(e);        }    }     _setData = async () => {          try {            await AsyncStorage.setItem('en', JSON.stringify(this.state.entree));            console.log("Donnée Sauvegardé : "+ this.state.entree)          } catch (err) {            console.log(err);          }    };    UNSAFE_componentWillMount(){        console.log("ComponentWillMount")           this._getData();         if(this.state.entree == false)          {              this.setState({                  colorButton: 'red',                  icoButton: 'sign-out-alt',              });          }         if(this.state.entree == true)          {              this.setState({                  colorButton: 'green',                  icoButton: 'sign-in-alt',              });          }            }    async componentDidMount(){        console.log("componentDidMount")          }    UNSAFE_componentWillUpdate(){        this._setData();        console.log("componentWillUpdate")    }    componentDidUpdate(){        console.log('componentDidUpdate')    }    componentWillUnmount() {        clearInterval(this.interval);        console.log("componentWillUnmount")    }    render() {        console.log("render : "+ this.state.entree);            return (<View style = {styles.main_containers}><View style={styles.containers_clock}><Text style={styles.style_text}>                               {this.state.time}    </Text> </View><View style={styles.containers_clock}><Text style = {styles.imei_text}>                            {this.state.DeviceIMEI}</Text></View><View style = {styles.containers_button_imei}><FontAwesome5.Button  style = {styles.button_imei}                                     name={this.state.icoButton}                                    backgroundColor='none'                                    onPress={() => this._getDeviceIMEI()}                                     size={250}                                     color={this.state.colorButton}                        /> </View></View>            )          }    }export default PointingMy Cycle of life : [Thu Jun 11 2020 11:00:45.363]  LOG      constructeur[Thu Jun 11 2020 11:00:45.366]  LOG      ComponentWillMount[Thu Jun 11 2020 11:00:45.367]  LOG      render : true[Thu Jun 11 2020 11:00:45.475]  LOG      componentDidMount[Thu Jun 11 2020 11:00:45.665]  LOG      componentWillUpdate[Thu Jun 11 2020 11:00:45.667]  LOG      render : true[Thu Jun 11 2020 11:00:45.669]  LOG      componentDidUpdate**[Thu Jun 11 2020 11:00:45.670]  LOG      Data comming : true[Thu Jun 11 2020 11:00:45.838]  LOG      Data save: true**

How to store object in iOS (Objective-C) and Android (Java) in a React Native App

$
0
0

I'm developing an app in React Native. I have to do something in native side (Objective-C for iOS and Java for Android).

I get after log in an object :

{"success":"true", "action":"logged", "email":"email@gmail.com", "password":"1234567:wZ", "id":"1"}

I want to store that object on native side and use the email to initiate some native module but I don't know how to do it.I can do it easily on React Native tho.

So what I would like to do is :

  1. Save the object
  2. Get the email of the object
  3. Use the email in something like this : [customFieldsDictionary setObject:@"email" forKey:@"f_EMail"];

Anyone can help me please ? This is totally new for me.Thank you very much!

video upload to vimeo using tus-android-client, Upload doesn't resume instead restart from 0 on resume

$
0
0

I am uploading video to vimeo using tus-android-client in react-native.The video is uploading but is not resuming on resume instead it restart from 0.

I'm following the Vimeo api's guide about resumable uploads (https://developer.vimeo.com/api/upload/videos#resumable-tus-upload).

Here is the code .

  class TusRunnable extends TusExecutor implements Runnable {    private TusAndroidUpload upload;    private TusUploader uploader;    private String uploadId;    private String uploadEndPoint;    private TusClient client;    private boolean shouldFinish;    private boolean isRunning;    public TusRunnable(String fileUrl, String uploadId, String endpoint, Map<String, String> metadata,        Map<String, String> headers) throws FileNotFoundException, MalformedURLException {      this.uploadId = uploadId;      this.uploadEndPoint = endpoint;      client = new TusClient();      // client.setUploadCreationURL(new URL(endpoint));      SharedPreferences pref = reactContext.getSharedPreferences("tus", 0);      client.enableResuming(new TusPreferencesURLStore(pref));      client.setHeaders(headers);      upload = new TusAndroidUpload(Uri.parse(fileUrl), reactContext);      upload.setMetadata(metadata);      shouldFinish = false;      isRunning = false;    }    protected void makeAttempt() throws ProtocolException, IOException {      uploader = client.beginOrResumeUploadFromURL(upload, new URL(uploadEndPoint));      uploader.setChunkSize(1024);      uploader.setRequestPayloadSize(10 * 1024 * 1024);      Timer progressTicker = new Timer();      progressTicker.scheduleAtFixedRate(new TimerTask() {        @Override        public void run() {          sendProgressEvent(upload.getSize(), uploader.getOffset());        }      }, 0, 500);      do {      } while (uploader.uploadChunk() > -1 && !shouldFinish);      sendProgressEvent(upload.getSize(), upload.getSize());      progressTicker.cancel();      uploader.finish();    }      }
Viewing all 28469 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>