react-doctor/rn-scrollview-dynamic-padding
Use `contentInset={{ bottom: dynamicValue }}` — the OS applies it as an offset without reflowing the scroll content
- Category: React Native
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: react-native
- Enabled when: framework=react-native and capabilities=react-native
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
The rule fires on ScrollView, FlatList, or FlashList opening elements whose contentContainerStyle is an inline ObjectExpression containing a paddingBottom or paddingTop Property whose value is anything other than a Literal — so identifiers, member expressions, and call expressions are flagged while literal numbers pass through. False positive: the dynamic identifier resolves to a value that only changes once at mount.
Fix prompt
Use this once validation confirms the diagnostic is real.
Lift the dynamic value out of contentContainerStyle and pass it via the ScrollView's contentInset={{ bottom: value }} prop; the OS applies it as an offset without re-laying out rows or re-pinning sticky headers. contentInset is iOS-only, so on Android pair it with KeyboardAvoidingView or react-native-keyboard-controller for keyboard-driven cases. See https://reactnative.dev/docs/scrollview#contentinset
Related rules
More React Native rules from the rules reference:
react-doctor/rn-scrollview-flex-in-content-container: Replace `flex: <positive number>` on contentContainerStyle with `flexGrow: 1`react-doctor/rn-style-prefer-boxshadow: Use the cross-platform CSS `boxShadow` string (RN v7+): `boxShadow: "0 2px 8px rgba(0,0,0,0.1)"` instead of platform-specific shadow*/elevation keysreact-doctor/expo-no-non-inlined-env: Use static dotted access: process.env.EXPO_PUBLIC_NAME (computed/destructured reads aren't inlined and are undefined at runtime)react-doctor/rn-animate-layout-property: Animate `transform: [{ translateX/Y }, { scale }]` and `opacity` instead of layout props — layout runs on the JS thread; transform/opacity run on the GPU compositorreact-doctor/rn-animation-reaction-as-derived: Replace useAnimatedReaction with `useDerivedValue(() => ..., [deps])` — shorter, native dependency tracking, no side-effect implication