Skip to content
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: use theme background for transparent text inputs #3980

Merged
merged 1 commit into from
Aug 2, 2023

Conversation

tjaniczek
Copy link
Collaborator

Summary

In outlined mode, the background color of the label is derived from colors?.background in theme or the backgroundColor style. When backgroundColor style is passed as transparent that would affect the border cover as well, resulting in border & label overlapping in active state.

This PR switches background of the cover from transparent back to theme's background as a last resort.

Closes: #3759

Test plan

Tested on the example app + simple unit test added.

image

@tjaniczek tjaniczek requested review from lukewalczak and teneeto July 17, 2023 19:04
@github-actions
Copy link

The mobile version of example app from this branch is ready! You can see it here.

@lukewalczak lukewalczak added this to the 5.10.0 milestone Jul 25, 2023
@lukewalczak lukewalczak merged commit c3a2dbd into main Aug 2, 2023
@ravithoria
Copy link

ravithoria commented Mar 23, 2024

@tjaniczek facing issue, outline colour overwrite label. Here is full code:

"react-native-paper": "^5.12.3",

Screenshot_2024-03-23-17-49-57-18_a0aa8ea80e4c2e6188751ba02385a958

import { MD3LightTheme as DefaultTheme, PaperProvider } from 'react-native-paper';
const theme = {
    ...DefaultTheme,
    colors: {
        ...DefaultTheme.colors,
        primary: 'tomato',
        secondary: 'yellow',
        background: 'transparent',
    },
};

export default function Main() {
    return (
        <PaperProvider theme={theme}>
            <App />
        </PaperProvider >
    );
}

AppRegistry.registerComponent(appName, () => Main);

=====
Home.js
=====
import { TextInput, useTheme } from 'react-native-paper';
export default function Home({) {
    const theme = useTheme();
return (
        <View style={CommonStyles.container}>
        <ImageBackground
                style={{ flex: 1, backgroundColor: 'black' }}
                source={require('../assets/images/gradientBlue.png')}>
                <TextInput
                    placeholder='Email'
                    label="Email"
                    mode={'outlined'}
                    value={email}
                    onChangeText={email => setEmail(email)}
                    textColor='white'
                    outlineColor='white'
                    activeOutlineColor='white'
                    style={{fontFamily: fonts.BeVietnamProRegular}}
                     theme={{
                     colors: { onSurfaceVariant: 'white'} // label colour
                      }}
                       />
         </ImageBackground >
        </View >
)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Outline line overlaps label
3 participants