Code Monkey home page Code Monkey logo

react-native-shake's People

Contributors

codemers avatar dlvoy avatar doko-demo-doa avatar harunsmrkovic avatar itsramiel avatar justjoostnl avatar lkinasiewicz avatar mattjbrill avatar mirocosic avatar msftenhanceprovenance avatar taylorono avatar wouterds avatar yalakkademy avatar zi6xuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-shake's Issues

minSdkVersion 18

I see that the minSdkVersion for Android is 18. My app supports SDK 16. Is there a critical reason why 18 was chosen? I read through most of the Android code and could not find any major issues.

Overly Sensitive Shake Event Detection on Android with v4.0.2

Overly Sensitive Shake Event Detection on Android with v4.0.2

I've been experiencing some problems with the shake event detection in version 4.0.2. It appears that even a slight movement of the device triggers the shake event on Android. This sensitivity level has led to an influx of complaints from my application's users, and it's reaching a point where I'm considering removing this library from my app.

While the shake detection on iOS has always been a bit on the sensitive side, it's manageable. However, the current behavior on Android is quite problematic and I would classify it as degraded functionality.

I'd appreciate it if you could look into this issue. It would be great if there was a way to adjust the sensitivity level or otherwise improve the shake detection algorithm to prevent false positives.

Thanks!

5.1.0 Uncaught Error in simulator

I used your sample code copy/pasta into a RN 0.66.3 app, and fired it up in a simulated iPhone 13 Pro. Got an error, even with the listener doing nothing yet:

`new NativeEventEmitter()` requires a non-null argument

This doesn’t happen when running it on device.

I don’t have a huge problem testing it on device, but someone who’s testing on lots of different devices probably needs the simulators so they don’t break the bank. Even if it’s not intended to work on a simulator it should really not throw errors and block devs in that regard.

I rolled it back to 3.5.0 and changed my syntax, and things worked. It does complain at me for typings, but oh well!

Thanks for your work on this lib! I have used it more than once, and am grateful.

sendEvent Error

Hello, in NShakeEventModule.java is not checking if react-native has started in its entirety.

You should include this improvement so that the application does not stop

image

How to reproduce the error? start the application and immediately shake the phone, which will cause the fall when trying to use the bridge even if you start.

Regards!

Not working on IOS

I tried on release mode, dev mode
but still it doesn't work the listener is not being triggered
I am using
"react-native-shake": "^5.6.0",
"react-native": "0.73.2",

Can't get it to work

I have tried installing this plugin both from the latest release tag and directly from master branch, I have tried building as a debug and and release apk, tried both on a real device (oneplus 3) but nothing happens when I shake the device. No logs, no alert, no trigger. Any ideas?

I'm using react native 0.57.7 and react 16.6.1


componentWillMount() {
    RNShake.addEventListener('ShakeEvent', () => {
   
      console.log('detected 'shake')

      Alert.alert(
        'Test',
        'shake happened',
        [
          { text: 'OK', onPress: () => console.log('OK Pressed') },
        ],
        { cancelable: false }
      )
    });

  }

componentWillUnmount() {

    RNShake.removeEventListener('ShakeEvent')
  }

Not working at all

Been shaking for last 10 minutes, nothing happened, tested on android physical device.

Package.json:

"expo": "~46.0.9",
"react": "18.0.0",
"react-native": "0.69.5",
"react-native-shake": "^5.1.1"

Code:

import RNShake from 'react-native-shake';

const App = () => {
  useEffect(() => {
    const unsub = RNShake.addListener(() => {
      console.log('shake shake!');
    });
    return () => unsub.remove();
  }, []);
  
  return (...)
}

DeviceEventEmitter doesn't remove Shake Event

I am using the library in 2 different components. I realized that the shake event is not removed in the removelistener and I have no idea on how to fix that. Especially the 2 shake event listener is the only one remove but still listens to the first one when I am not in the component.
Can you try and fix this?

`new NativeEventEmitter()` requires a non-null argument., js engine: hermes Error

Hello 👋

At new version 5.2.0
/react-native-shake/lib/index.js
const _eventEmitter = new react_native_1.NativeEventEmitter();

This code line give an error because have forgotten parametre in react_native_1.NativeEventEmitter(). You should have added parametre.

Code line with parametre
const _eventEmitter = new react_native_1.NativeEventEmitter(react_native_1.NativeModules.RNShakeEvent);

Event listener

When integrating the lib in my app, I used addEventListener and removeEventListener as I normally do, by passing for both the handler function.

Turns out the handler was triggered unexpectedly when removing the event listener.

After looking at the source code I saw it was on purpose:
https://github.com/Doko-Demo-Doa/react-native-shake/blob/master/index.js#L32

My question is: What was the intention being calling handler when removing the listener?

Also, since the listener is set in the lib, one can listen multiple times but remove only the latest listener:

// Subscribe multiple times works
RNShake.addEventListener('ShakeEvent', handlerA)
RNShake.addEventListener('ShakeEvent', handlerB)

// Removing only works for latest listener
// and triggers both handleA and handleB, unexpectedly
RNShake.removeEventListener('ShakeEvent', handlerB)
RNShake.removeEventListener('ShakeEvent', handlerA)

// handleA will still be triggered on shake

I guess you wanted to keep the addEventListener/removeEventListener for compatibility reasons (since addListener is preferred now), so what about providing both alternatives, with a twist on the legacy ones to handle multiple listeners?

'use strict';

import React, { DeviceEventEmitter, NativeModules } from 'react-native';
import invariant from 'invariant';

const listeners = new Map();

class RNShake {
  static addListener (type: string, handler: Function) {
    invariant(
      type === 'ShakeEvent',
      'RNShake only supports `ShakeEvent` event'
    );

    return DeviceEventEmitter.addListener('ShakeEvent', handler);
  }
  
  static addEventListener(type: string, handler: Function) {
    invariant(
      type === 'ShakeEvent',
      'RNShake only supports `ShakeEvent` event'
    );

    invariant(
      !listeners.has(handler),
      'Duplicate handler for `ShakeEvent` of RNShake'
    );

    listeners.set(
      handler, 
      DeviceEventEmitter.addListener('ShakeEvent', handler)
    );
  }
  
  static removeEventListener(type: string, handler: Function) {
    invariant(
      type === 'ShakeEvent',
      'RNShake only supports `ShakeEvent` event'
    );

    if (handler) {
      const listener = listeners.get(handler);
      if (listener) {
        listener.remove();
        listeners.delete(handler);
      }
    }
    else {
      // Remove all listeners added via `addEventListener`
      for (const listener of listeners.values()) {
        listener.remove();
      }
      listeners.clear();
    }
  }
};

module.exports = RNShake;

update the npm package

Excuse me, can you update to npm on the merged pod support function in the past few days?

Q - Usage in functional components

Hi -
Very handy library, thanks!
I'm using the pattern:

 useEffect(() => {
        const subscription = RNShake.addListener(onUndo);
        return () => subscription.remove();
    });

is this a valid way to do it, or should I be using removeListener() ... or both?

Autolink issues with RN > 0.60

I get this error when building on IOS:

React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-shake 

Configure shake sensitivity

Just by walking with the cell phone in my pants pocket the event runs. How could I decrease the sensitivity?

Too senstive

Hello, Sir

First of all, Thank you for this npm.
But, I have a little bit problem on it.
the shake function works out even in very small motion gesture.
Do you have any solution to reduce too much senstive?

Thank you
Yuchang

shaked not working on ios when app in background

I tested react-native-sensors in background and it works, event on screen off!.
But somehow the shake is not detected when the app is in background.

Is there any fix or some hack to suggest?

[iOS] RN 0.60.5 build failed

I have successfully built this package on Android but fails on iOS. May I know how to successfully install on RN 0.60.5 with autolinking?

Error on xCode: library not found for RNShakeEvent

微信图片_20200119033911

Pod install Failure

I got the below error when running Pod install after install this package.

[!] Invalid `Podfile` file: 
[!] Invalid `react-native-shake.podspec` file: undefined method `install_modules_dependencies' for Pod:Module
Did you mean?  install_flipper_dependencies.

[ANDROID] Not working on latest react-native

Just tried to use it on react-native 0.54 it worked on iOS but not on Android :(

import PropTypes from 'prop-types'
import RNShake from 'react-native-shake'
import React, { PureComponent } from 'react'

export default class App extends PureComponent {
  componentDidMount() {
    RNShake.addEventListener('shake', this.handleShake)
  }

  componentWillUnmount() {
    RNShake.removeEventListener('shake')
  }

  handleShake = () => {
    alert('Shaked')
  }

  render() {
    // return ...
  }
}

Also please add Usage on README.

Sending `ShakeEvent` with no listeners registered.

Hi on iOS after a proper install of this module and adding the event listener to a useEffect, whenever I shake the device, I get the below error message

Sending ShakeEvent with no listeners registered.

Here's my useEffect

useEffect(() => {
    // This gets logged
    console.log('catch shake')
    
    const subscription = RNShake.addListener(() => {
      // But this never gets logged on iOS
      console.log('shake shake shake')
      
      shouldInitiateReview('report-problem')
    })

    return () => {
      subscription.remove()
    }
  }, [])

Can not work on android

It works well on IOS.
On android, it does not go to addEventListener function.
Please help me fix it.

buildToolsVersion is not specified.

Versions:
"react": "16.3.0-alpha.1",
"react-native": "0.54.2",
"react-native-shake": "^3.2.1"

Output:
Scanning folders for symlinks in C:\Users\xxxxx\Documents\react\testshake\node_modules (38ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':app'.
    > Could not resolve all dependencies for configuration ':app:_debugApk'.
    > A problem occurred configuring project ':react-native-shake'.
    > buildToolsVersion is not specified.

android fails to build with rn 0.72.11 and shake 5.6.0

When i build the android app with gradle, I get the error below.

> Task :react-native-shake:buildCodegenCLI FAILED

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':react-native-shake:buildCodegenCLI'.
> A problem occurred starting process 'command '/Users/XXX/projects/rnprj/node_modules/react-native-codegen/scripts/oss/build.sh''

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':react-native-shake:buildCodegenCLI'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:142)
        at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:140)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:128)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
        at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
        at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
        at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
        at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:69)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:327)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:314)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:307)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:293)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:420)
        at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:342)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Users/xxx/projects/rnprj/node_modules/react-native-codegen/scripts/oss/build.sh''
        at org.gradle.process.internal.DefaultExecHandle.execExceptionFor(DefaultExecHandle.java:241)
        at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:218)
        at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:370)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:87)
        at org.gradle.internal.operations.CurrentBuildOperationPreservingRunnable.run(CurrentBuildOperationPreservingRunnable.java:42)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Users/xxx/projects/rnprj/node_modules/react-native-codegen/scripts/oss/build.sh'
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
        at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
        at org.gradle.process.internal.ExecHandleRunner.startProcess(ExecHandleRunner.java:98)
        at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:71)
        ... 3 more
Caused by: java.io.IOException: Cannot run program "/Users/xxx/projects/rnprj/node_modules/react-native-codegen/scripts/oss/build.sh" (in directory "/Users/xxx/projects/rnprj/node_modules/react-native-shake/android"): error=2, No such file or directory
        at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
        ... 6 more
Caused by: java.io.IOException: error=2, No such file or directory
        ... 7 more

I think this was because I didn't have react-native-codegen installed.

So I installed that:

$ yarn add --dev react-native-codegen

And then I tried to rerun gradle, and this time it failed with a different error:

> Task :react-native-shake:generateCodegenSchemaFromJavaScript FAILED
node:internal/fs/utils:351
    throw err;
    ^

Error: ENOENT: no such file or directory, lstat 'android'
    at Object.lstatSync (node:fs:1684:3)
    at /Users/xxx/projects/rnprj/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:75:10
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/xxx</anonymous>/projects/rnprj/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:74:10)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -2,
  syscall: 'lstat',
  code: 'ENOENT',
  path: 'android'
}

Node.js v20.5.1

I feel like I must be doing something stupid but I'm not sure what. suggestions?

I noticed this bug, but not sure what the solution should be:
facebook/react-native#36286

Not working at all

I tested my physical phone and I'm sure 'release' version.

"react": "18.2.0",
"react-native": "^0.72.5",
"react-native-shake": "^5.6.2"

useEffect(() => { Alert.alert('shake!'); RNShake.addListener(() => Alert.alert('done!')); return () => { RNShake.removeAllListeners(); }; }, []);

it only works 'Alert.alert('shake!')'

Event not firing on iOS 12.0 for RN 0.60.4

The Shake event is not getting triggered in RN 0.60.4

componentDidMount() {
RNShake.addEventListener('ShakeEvent', () => {
// Your code...
Alert.alert('Shake', 'Shake event is called...');
});
}

Does not work with new architecture on iPhone

Steps to reproduce

npx react-native@latest init shake-feature
npm install react-native-shake
cd ios
RCT_NEW_ARCH_ENABLED=1 pod install
cd ..
npm run ios

output

** BUILD FAILED **


The following build commands failed:
        CompileC /Users/otaylor/Library/Developer/Xcode/DerivedData/shakefeature-dxixmjagieegoqcfiycawrtajqqq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/react-native-shake.build/Objects-normal/x86_64/RNShake.o /Users/otaylor/workspace/shakefeature/node_modules/react-native-shake/ios/RNShake.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'react-native-shake' from project 'Pods')
image

NativeRNShake interface is not generated as part of code gen

This appears to related to compiling the NativeRNShake.ts file to javascript, code gen is no longer correctly detecting it.

Too strict peerDependency

Hello,

I found that this plugin defines an exact react-native peerDependency, currently 0.71.6 as 5.3.2 which prevents me to upgrade to 0.71.7 without changing every npm command to use legacy peer deps or force.

Is there any specific reason to not use like ^0.71 for peer dependency?
Thanks

react native version Up plz

Hello,

I found that this plugin defines an exact react-native peerDependency, currently 0.71.6 as 5.5.0 which prevents me to upgrade to 0.72.3 without changing every npm command to use legacy peer deps or force.

Could you please update react-native to the latest version?

Thanks

Shake on android don't work

Hello everyone. I had problems with the shake on android, I tried both on emulators and on real devices, nothing worked.

Decided change custom listener on to shake listener from React Native code lib.

Create pull request for this #26

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNShake' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes

Getting this error after upgrading to 5.5.0.

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
 ERROR  Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes

Error: register failed, the sensor listeners size has exceeded the maximum limit 128

Getting the error below on Android devices.

One thing I noticed is that there is a stop method on the detector, but nothing is calling it.

Has anyone ran into this issue?

Fatal Exception: java.lang.IllegalStateException: register failed, the sensor listeners size has exceeded the maximum limit 128
       at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:186)
       at android.hardware.SensorManager.registerListener(SensorManager.java:833)
       at android.hardware.SensorManager.registerListener(SensorManager.java:740)
       at com.clipsub.RNShake.CustomShakeDetector.start(CustomShakeDetector.java:68)
       at com.clipsub.RNShake.RNShakeEventModule.<init>(RNShakeEventModule.java:27)
       at com.clipsub.RNShake.RNShakeEventPackage.createNativeModules(RNShakeEventPackage.java:17)
       at com.facebook.react.ReactPackageHelper.getNativeModuleIterator(ReactPackageHelper.java:42)
       at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:42)
       at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1476)
       at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1447)
       at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1341)
       at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:138)
       at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1111)
       at java.lang.Thread.run(Thread.java:1012)

Unable to build after migrating to react native 0.60

As the title says, after I have upgraded React Native to 0.60, I can't compile react-native-shake.

I get the following error in RNShakeEventModule
error: package android.support.annotation does not exist

I figured it had something to do with Android X, so I replaced the package with:
import androidx.annotation.Nullable;

I cleaned the project (removed the build folder) and rebuild the project, but then i get the following compiler errors:
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete
Caused by: com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# fields: 65702 > 65536)

Is anyone getting similar errors or have a working react-native 0.60 with react-native-shake?

Breaking android compilation on 5.4.0

I installed this package today. on iOS it works fine but it doesn't build for Android. I've downgraded to the previous version and it works well

> Task :react-native-shake:generateCodegenSchemaFromJavaScript FAILED
/dir/node_modules/flow-parser/flow_parser.js:807
throw a}function
^

Error: ENOENT: no such file or directory, lstat '/dir/node_modules/react-native-shake/src'
    at Object.lstatSync (node:fs:1566:3)
    at /dir/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:26:10
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/dir/node_modules/react-native-codegen/lib/cli/combine/combine-js-to-schema-cli.js:25:10)
    at Module._compile (node:internal/modules/cjs/loader:1126:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
    at Module.load (node:internal/modules/cjs/loader:1004:32)
    at Function.Module._load (node:internal/modules/cjs/loader:839:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  errno: -2,
  syscall: 'lstat',
  code: 'ENOENT',
  path: '/dir/node_modules/react-native-shake/src'
}

ENOENT: no such file or directory, lstat '/dir/node_modules/react-native-shake/src'

Execution failed for task ':react-native-shake:generateCodegenSchemaFromJavaScript'.
> Process 'command 'node'' finished with non-zero exit value 7

Xcode 12 compatibility

Hello! There was a change (#22) to support Xcode 12 in version 3 of this project, but the change seems to be missing in the latest version. Is it possible to release a new version with this change included? Thanks! 🙏🏻

removeListener method has been deprecated.

There is an upstream change, where in [email protected] they deprecated the old API in favour of a more terse name, so removeListener() became remove() (more information can be found here).

For React Native projects greater than 0.65.0 version, the following warning is shown in the console:

EventEmitter.removeListener('ShakeEvent', ...): Method has been deprecated.
Please instead use `remove()` on the subscription returned by `EventEmitter.addListener`.

The problem lies in the implementation of the removeListener method:

removeListener: (callback: () => void | undefined) =>
    _eventEmitter.removeListener('ShakeEvent', () => {
      callback?.()
    }),

Is this package still maintained to a point where this will change soon?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.