Closed outaTiME closed 4 months ago
Does pressing the X button call setResult('ok')
?
Can you share the js and adb logs?
Indeed, the x button press makes a call to props.setResult('ok')
, (as I mentioned before) in the other android versions it works as expected. It seems to be something exclusive of this version.
The JS of the configuration screen has quite a lot of code (and I don't have it uploaded yet in my repository) but its general structure is the following:
<GestureHandlerRootView style={{ flex: 1 }}>
<SafeAreaProvider>
<ThemeProvider theme={theme}>
<HeaderButtonsProvider stackType="native">
<ScrollView>
<ContentView contentContainerStyle={{ flex: 1 }}>
<View
style={{
paddingVertical: Settings.CARD_PADDING,
marginHorizontal: Settings.CARD_PADDING,
flexDirection: 'row',
marginBottom: -Settings.CARD_PADDING,
justifyContent: 'flex-end',
}}
>
<MaterialHeaderButtons>
<Item
title="Cerrar"
iconName="close"
onPress={() => {
props.setResult('ok');
}}
buttonStyle={{
marginHorizontal: Settings.PADDING,
}}
/>
</MaterialHeaderButtons>
</View>
<CardView title="Cotización" plain>
{rateTypes.map((type, index) => (
<CardItemView
key={type}
title={AmbitoDolar.getRateTitle(type)}
useSwitch={false}
chevron={false}
check={
config.rate === type || (!config.rate && index === 0)
}
onAction={() => {
saveSetting('rate', type);
}}
/>
))}
</CardView>
<CardView title="Mostrar" plain>
{['buy', 'average', 'sell'].map((type, index) => (
<CardItemView
key={type}
title={I18n.t(type)}
useSwitch={false}
chevron={false}
check={
config.value === type ||
(!config.value && index === 2)
}
onAction={() => {
saveSetting('value', type);
}}
/>
))}
</CardView>
</ContentView>
</ScrollView>
</HeaderButtonsProvider>
</ThemeProvider>
</SafeAreaProvider>
</GestureHandlerRootView>
in a while I will see if I can see some logs inside the ADB
I meant js log if there are some errors there.
My guess is that some of the APIs used in the java code are not available in Android 6, and there should be some error in the adb log.
I meant js log if there are some errors there.
My guess is that some of the APIs used in the java code are not available in Android 6, and there should be some error in the adb log.
I understand,
I was looking at the execution logcat when placing a widget on the screen and there is an exception coming from android.widget.FrameLayout
, I leave the full log here (collapsed).
Looks like a part of the log is missing, since there is no reference to code from this library in the log.
From the log it seems to fail on setMinimumHeight
, which is called for clickable views (which is strange because you don't have clickAction
in your widget).
setMinimumHeight
is called to set up the "button" in the widget which can be clicked. This was implemented in another way before, but in some cases the "button" was not on the correct place in the widget, and setMinimumHeight
had to be used.
Looks like setMinimumHeight
became "RemotableViewMethod" in Android 7
Did you remove clickAction
from the example above?
If not, can you share more of the log?
I'm looking at the log from the Android Studio, and it represents the moment I drag the widget from the palette, drop it and close the configuration window.
I don't see any reference to your library, should I open the application? The compilation I'm running is preview (practically productive), would it be useful to try another type of compilation on the dev client?
On the other hand, it is correct what you say, the widget code that I attached was a simple version of the original one uses the clickAction
:
import React from 'react';
import { FlexWidget, TextWidget } from 'react-native-android-widget';
export default function RateWidget(props) {
const size = props.size || 130;
const padding = 14;
const borderRadius = 20;
return (
<FlexWidget
style={{
height: 'match_parent',
width: 'match_parent',
justifyContent: 'center',
alignItems: 'center',
}}
>
<FlexWidget
style={{
height: size,
width: size,
backgroundColor: '#000',
padding,
borderRadius,
}}
clickAction="OPEN_URI"
clickActionData={{
uri: 'ambito-dolar://rates',
}}
>
<TextWidget
text="Blue"
style={{
fontSize: 18,
fontFamily: 'FiraGO-Regular-Minimal',
color: '#FFF',
}}
maxLines={1}
/>
<FlexWidget style={{ flex: 1, justifyContent: 'flex-end' }}>
<TextWidget
text="0.00% ="
style={{
fontSize: 12,
fontFamily: 'FiraGO-Regular-Minimal',
color: 'rgba(10,132,255,1)',
}}
maxLines={1}
/>
<TextWidget
text="1,025.00"
style={{
fontSize: 24,
fontFamily: 'FiraGO-Regular-Minimal',
color: '#FFF',
}}
maxLines={1}
/>
<TextWidget
text="25/04 15:45"
style={{
fontSize: 10,
fontFamily: 'FiraGO-Regular-Minimal',
color: 'rgba(142,142,147,1)',
marginTop: 5,
}}
maxLines={1}
/>
</FlexWidget>
</FlexWidget>
</FlexWidget>
);
}
I think I will have to disable clickAction
on Android 6, since that method is not available.
I could try to use a different approach only for Android 6, but that had other issues like clickable area on wrong place in the widget.
I released 0.13.2
that disables clickAction
on Android 6, can you try again?
I released
0.13.2
that disablesclickAction
on Android 6, can you try again?
Thanks @sAleksovski, the new version worked perfectly logically without clickAction
but it does not bother and especially considering that soon this version of android is no longer supported.
Hello there, I am doing some tests with my widget on different versions of android and on version 6 (API 23) the widget does not load and the following error appears:
I put different traces and the task handler along with the rendering of the widget is running correctly.
Notice, I'm using Expo 50 and this only happens with this specific version of Android, I don't know if anyone else experienced this kind of problem.
Here some code along with the plugin definition in the app.config: