react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

Using dark theme on iOS

Open ajengrf opened this issue 5 years ago • 5 comments

I want to use react-native-paper dark theme on my apps, however, all my <View> are still had a white background and causing all the Text component unreadable because the text turns white in dark mode. I didn't use custom theming since the docs mention that:

If you don't use a custom theme, Paper will automatically turn animations on/off, depending on device settings.

This is my code in App.js:

import React from 'react';
import {Provider as PaperProvider} from 'react-native-paper';
import Home from './src/Home';

const App = () => {
  return (
    <PaperProvider>
      <Home />
    </PaperProvider>
  );
};

export default App;

This is in my Home.js:

import React from 'react';
import {View} from 'react-native';
import {Appbar, Card, Title} from 'react-native-paper';

const Home = () => {
  return (
    <View style={{flex: 1}}>
      <Appbar.Header>
        <Appbar.BackAction onPress={() => console.log('back')} />
        <Appbar.Content title="Title" subtitle={'Subtitle'} />
      </Appbar.Header>
      <View>
        <Title>Hello World</Title>
        <Card
          style={{margin: 15, padding: 15}}
          onPress={() => console.log('press card')}>
          <Title>This is Card</Title>
        </Card>
      </View>
    </View>
  );
};

export default Home;

and this is the result: Simulator Screen Shot - iPhone 11 - 2021-02-19 at 06 36 50

The text turns white because it is the behavior of dark mode, but why my <View> is still white? This is only happening on iOS, it works fine on android.

It works fine on android device 43225

This is a new react native project, and based on documentation in react-native-paper it will turn the dark theme automatically. So, I need help if I missed something in setting up this project on iOS. Any help would be appreciated.

  • react: 16.13.1
  • react-native: 0.63.4
  • react-native-paper: ^4.7.1
  • react-native-vector-icons: ^8.0.0

ajengrf avatar Feb 18 '21 23:02 ajengrf

Couldn't find version numbers for the following packages in the issue:

  • react-native
  • react-native-paper
  • react-native-vector-icons

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

github-actions[bot] avatar Feb 18 '21 23:02 github-actions[bot]

you can use `import * as React from 'react'; import { withTheme } from 'react-native-paper';

function MyThemedView(props) { const { colors } = props.theme; return <View style={[{ backgroundColor: colors.primary }, props.style]}/>; }

export default withTheme(MyComponent);`

GiFarina avatar Feb 22 '21 22:02 GiFarina

Hello 👋, this issue has been open for more than 2 months with no activity on it. If the issue is still present in the latest version, please leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution on workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix the issue.

github-actions[bot] avatar Apr 24 '21 00:04 github-actions[bot]

Anything new here ? I still have the same issue

ArtArnaud avatar Jan 12 '23 21:01 ArtArnaud

This is not actually an bug. The package does not contain a custom view. You can create by yourself like @GiFarina's answer

OkancanCosar avatar Apr 23 '24 11:04 OkancanCosar