-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolves #1103 - crash on disconnect #1111
fix: resolves #1103 - crash on disconnect #1111
Conversation
d2cf645
to
95ae38b
Compare
@@ -36,22 +36,36 @@ | |||
import com.bleplx.converter.ServiceToJsObjectConverter; | |||
import com.bleplx.utils.ReadableArrayConverter; | |||
import com.bleplx.utils.SafePromise; | |||
import com.polidea.rxandroidble2.internal.RxBleLog; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we really use an internal log method here?
The benefits are it follows log level settings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more places in library where it was used...
We should think about global refactor of this.
@@ -21,7 +21,7 @@ export function TestStateDisplay({ label, state, value }: TestStateDisplayProps) | |||
<Container> | |||
<Header> | |||
<Label>{label}</Label> | |||
<AppText>{marks[state]}</AppText> | |||
{state && <AppText>{marks[state]}</AppText>} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use a terniary in views, so:
{state ? <AppText>{marks[state]}</AppText> : null}
If a boolean false would be passed to state
it would now visualize False
which probably is not intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure? As far as I know, visualizing False was removed a few years ago. When conditional rendering gets false it just not rendering (renders nothing in this place). The problem will only appear when you use the number 0 as a condition. The component allows you to pass only 'DONE' | 'WAITING' | 'ERROR' | 'IN_PROGRESS' values in this place. As a result, in this case, adding : null
does not help at all, but prolongs the code. To be fully safe, all we need to do is parse the condition to boolean.
eg.
I added one more small fix for Android. There was a bug when user tried to run connectWithDevice method multiple times. |
...rc/screens/MainStack/DeviceConnectDisconnectTestScreen/DeviceConnectDisconnectTestScreen.tsx
Outdated
Show resolved
Hide resolved
...rc/screens/MainStack/DeviceConnectDisconnectTestScreen/DeviceConnectDisconnectTestScreen.tsx
Outdated
Show resolved
Hide resolved
...rc/screens/MainStack/DeviceConnectDisconnectTestScreen/DeviceConnectDisconnectTestScreen.tsx
Outdated
Show resolved
Hide resolved
…thub.com/dotintent/react-native-ble-plx into bugfix/handle-android-connecton-problems
The issue origin starts in RxAndroidBle library - for now I only added global handling of undeliverable RxJava errors, with message in logcat.