A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.
JavaScript claude-code-pluginclaude-code-skillscode-appsgithub-copilot-pluginpower-appspower-pagespower-platform
fix(mobile-apps): use onChangeText for Tamagui inputs (#724)
Prabhat Ojhac4305aaf7130
diff --git a/plugins/mobile-apps/agents/screen-builder.md b/plugins/mobile-apps/agents/screen-builder.mdindex 9334c0a18..253adfe41 100644--- a/plugins/mobile-apps/agents/screen-builder.md+++ b/plugins/mobile-apps/agents/screen-builder.md@@ -915,6 +915,7 @@ export default function <ScreenName>Screen() {- **Detail routes** like `/(app)/inspections/[id]` use `useLocalSearchParams<{ id: string }>()` from `expo-router`- **Form screens** use `react-hook-form` if installed; otherwise inline `useState` per field for v0+- **Tamagui text controls** — use `onChangeText={(text) => ...}` for `<Input>` and `<TextArea>`. Do not read `target.value` or `nativeEvent.text` from their `onChange` event: Tamagui types that callback as a web `Event`, while `onChangeText` is consistently string-valued on web and native.- **Choice / picklist fields in forms** — use Tamagui `<Select>` with the generated const. The const lives in `src/generated/models/<Entity>Model.ts` and maps int values (as string keys) to label strings (e.g. `Cr123_Projectstatus = { '100000000': 'Active', ... }`). Use `Object.entries(Const)` to build `<Select.Item>` elements. Convert to/from string at the `Select` boundary (`String(field.value)` in, `Number(v)` out). Never hardcode option values. For read-only display (list rows, detail fields), use the `formattedValue(record, '<columnLogicalName>')` helper from `@/utils`, or fall back to the generated const lookup (`Cr123_Projectstatus[String(record.cr123_status)]`). NEVER invent/read a separate `*name` shadow property and NEVER inline the raw annotation key. See the "Choice / picklist select" recipe in `shared/references/tamagui-component-recipes.md`.- **Fallback — const missing or model file absent:** emit a plain `<Input>` storing the raw int as a string, with a TODO comment:```tsx@@ -922,7 +923,7 @@ export default function <ScreenName>Screen() {Re-run `$PA app add data-source` from the app root with explicit connector/table flags to regenerate, then replace with <Select>. */}<Inputvalue={String(field.value ?? '')}- onChange={event => field.onChange(Number(event.target?.value ?? event.nativeEvent?.text ?? ''))}+ onChangeText={value => field.onChange(Number(value) || 0)}inputMode="numeric"/>```diff --git a/plugins/mobile-apps/scripts/tests/template-quality-contract.test.js b/plugins/mobile-apps/scripts/tests/template-quality-contract.test.jsindex c107c5427..0b114ac12 100644--- a/plugins/mobile-apps/scripts/tests/template-quality-contract.test.js+++ b/plugins/mobile-apps/scripts/tests/template-quality-contract.test.js@@ -128,6 +128,20 @@ test('shared components preserve token literals and accessible row selection semassert.doesNotMatch(components, /<Ionicons[^>]*color="\$[A-Za-z]/);});+test('Tamagui text-control guidance uses the cross-platform string callback', () => {+ const textControlGuidance = [+ 'agents/screen-builder.md',+ 'shared/references/tamagui-component-recipes.md',+ 'shared/references/universal-patterns.md',+ 'shared/samples/screen-form.tsx',+ 'shared/samples/screen-list.tsx',+ ].map(read).join('\n');++ assert.match(textControlGuidance, /onChangeText/);+ assert.doesNotMatch(textControlGuidance, /event\.target\?\.value/);+ assert.doesNotMatch(textControlGuidance, /event\.nativeEvent\?\.text/);+});+test('template path aliases are inherited from the host tsconfig', () => {const tsconfig = JSON.parse(read('template/tsconfig.json'));assert.strictEqual(tsconfig.extends, '@microsoft/power-apps-native-host/config/tsconfig');diff --git a/plugins/mobile-apps/shared/references/tamagui-component-recipes.md b/plugins/mobile-apps/shared/references/tamagui-component-recipes.mdindex 5fd9b4db3..61061b173 100644--- a/plugins/mobile-apps/shared/references/tamagui-component-recipes.md+++ b/plugins/mobile-apps/shared/references/tamagui-component-recipes.md@@ -438,7 +438,7 @@ const shadows = {<Input id="email" size="$4" bg="$color3" borderWidth={0}focusStyle={{ borderWidth: 2, borderColor: '$blue8' }}value={email}- onChange={event => setEmail(event.target?.value ?? event.nativeEvent?.text ?? '')} />+ onChangeText={setEmail} />{error && <Text color="$red10" fontSize="$2">{error}</Text>}</YStack>```diff --git a/plugins/mobile-apps/shared/references/universal-patterns.md b/plugins/mobile-apps/shared/references/universal-patterns.mdindex 70dd9a54c..1f967221f 100644--- a/plugins/mobile-apps/shared/references/universal-patterns.md+++ b/plugins/mobile-apps/shared/references/universal-patterns.md@@ -127,7 +127,7 @@ const [filters, setFilters] = React.useState({ status: 'all', dateRange: 'all',<XStack flex={1} items="center" bg="$color3" rounded="$3" px="$3" gap="$2"><Search size={18} color="$color9" /><Input flex={1} placeholder="Search..." value={search}- onChange={event => setSearch(event.target?.value ?? event.nativeEvent?.text ?? '')}+ onChangeText={setSearch}bg="transparent" borderWidth={0} px="$0" /></XStack><Button size="$3" icon={SlidersHorizontal} chromeless onPress={() => setShowFilters(true)}>@@ -354,7 +354,7 @@ Used for: field data entry with gloved hands, accessibility.```tsx<XStack items="center" gap="$2"><Input flex={1} placeholder="Enter notes..." value={value}- onChange={event => onChange(event.target?.value ?? event.nativeEvent?.text ?? '')} />+ onChangeText={onChange} /><Button size="$3" circular chromelessicon={isListening ? MicOff : Mic}color={isListening ? '$red10' : '$color9'}@@ -731,7 +731,7 @@ function ValidatedInput({ label, value, onChange, validate, successMessage }) {borderWidth={result ? 2 : 0}borderColor={result?.valid ? '$green8' : result ? '$red8' : 'transparent'}><Input flex={1} value={value}- onChange={event => onChange(event.target?.value ?? event.nativeEvent?.text ?? '')}+ onChangeText={onChange}onBlur={() => setTouched(true)}bg="transparent" borderWidth={0} />{result?.valid && <CheckCircle2 size={18} color="$green10" />}diff --git a/plugins/mobile-apps/shared/samples/screen-form.tsx b/plugins/mobile-apps/shared/samples/screen-form.tsxindex 5bfb6ea1a..e1938f345 100644--- a/plugins/mobile-apps/shared/samples/screen-form.tsx+++ b/plugins/mobile-apps/shared/samples/screen-form.tsx@@ -91,7 +91,7 @@ export default function RecipeFormScreen() {autoComplete="off"enterKeyHint="next"value={field.value}- onChange={(event) => field.onChange(event.target?.value ?? event.nativeEvent?.text ?? '')}+ onChangeText={field.onChange}onBlur={field.onBlur}/>{fieldState.error && (@@ -113,7 +113,7 @@ export default function RecipeFormScreen() {numberOfLines={4}enterKeyHint="enter"value={field.value ?? ''}- onChange={(event) => field.onChange(event.target?.value ?? event.nativeEvent?.text ?? '')}+ onChangeText={field.onChange}onBlur={field.onBlur}/>{fieldState.error && (@@ -135,10 +135,7 @@ export default function RecipeFormScreen() {inputMode="numeric"enterKeyHint="done"value={String(field.value ?? '')}- onChange={(event) => {- const value = event.target?.value ?? event.nativeEvent?.text ?? ''- field.onChange(Number(value) || 0)- }}+ onChangeText={(value) => field.onChange(Number(value) || 0)}onBlur={field.onBlur}/>{fieldState.error && (diff --git a/plugins/mobile-apps/shared/samples/screen-list.tsx b/plugins/mobile-apps/shared/samples/screen-list.tsxindex 433f71bd7..2d8211df1 100644--- a/plugins/mobile-apps/shared/samples/screen-list.tsx+++ b/plugins/mobile-apps/shared/samples/screen-list.tsx@@ -64,7 +64,7 @@ export default function RecipesListScreen() {size="$4"placeholder="Search recipes…"value={query}- onChange={(event) => setQuery(event.target?.value ?? event.nativeEvent?.text ?? '')}+ onChangeText={setQuery}/></XStack>