Problem
I am using @react-native-community/picker to create one picker field and it has one callback function called onValueChange which gets called when some value is selected. Now, when I am running my app normally of my android device, at the first render, onValueChange is not triggered. But when I am running my app through Appium, onValueChange gets called on first render.
This will cause infinite render if some function is used to called setState in parent element. Am I doing something wrong in the code or Appium side?
** Environment**
- Appium version (or git revision) that exhibits the issue: 1.17.1-1
- Last Appium version that did not exhibit the issue (if applicable):
- Desktop OS/version used to run Appium: macOS High Sierra Version 10.13.6 (17G14019)
- Node.js version (unless using Appium.app|exe): My machine -> 10.14.2 || Under about Appium it shows Nodejs: 12.8.1
- Npm or Yarn package manager: npm version 6.4.1
- Mobile platform/version under test:
- Real device or emulator/simulator: Xiaomi POCO F1 Android 10
- Appium CLI or Appium.app|exe: Appium app on Mac
** Link to Appium logs**
Code To Reproduce Issue
Install @react-native-community/picker
in dummy react native project.
after the write the code bellow in app.js
The console log doesn’t log anything on the first render when app is running normally. But it logs the string on first render when app is running via appium.
import React, { useState } from 'react'
import {Picker} from '@react-native-community/picker';
const app = () => {
const [language, setLanguage] = useState('')
return (
<Picker
selectedValue={language}
style={{height: 50, width: 100}}
onValueChange={(itemValue, itemIndex) => {
console.log('on change called')
setLanguage(itemValue)
}}
>
<Picker.Item label="Java" value="java" />
<Picker.Item label="JavaScript" value="js" />
</Picker>
)
}