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

Touchable Opacity - v4.0.1 #864

Open
saltxf opened this issue Apr 2, 2024 · 4 comments
Open

Touchable Opacity - v4.0.1 #864

saltxf opened this issue Apr 2, 2024 · 4 comments

Comments

@saltxf
Copy link

saltxf commented Apr 2, 2024

When using the className prop on TouchableOpacity, the appearance does not change. However, when using regular CSS styles, the appearance changes as expected. This can be observed in the difference between image 1 using className and image 2 using regular CSS styles.

Code:


import {
  View,
  TouchableOpacity,
  Text,
  ImageBackground,
  TextInput,
  Platform,
  StatusBar as StatusBarReact,
} from 'react-native';
import '@/global.css';
import React from 'react';

import { MagnifyingGlassIcon } from 'react-native-heroicons/outline';

const index = () => {
  return (
    <View className='flex-1 relative '>
      <ImageBackground
        className={`flex-1 flex `}
        source={require('@/assets/images/bg.png')}
        resizeMode='cover'
        style={{
          paddingTop:
            Platform.OS === 'android' ? StatusBarReact.currentHeight : 0,
        }}
      >
        <View style={{ height: '10%' }} className='mx-4'>
          <View className='flex-row items-center rounded-full  bg-white'>
            <TextInput
              placeholder='Search city'
              placeholderTextColor={'gray'}
              className='pl-6 h-10 flex-1 text-base text-white'
            />
            <TouchableOpacity
              onPress={() => {}}
              // className={'rounded-full p-3 m-1 bg-blue-600'}
              style={{
                backgroundColor: '#1E90FF',
                borderRadius: 50,
                padding: 10,
                margin: 1,
              }}
            >
              <MagnifyingGlassIcon size='20' color='white' />
            </TouchableOpacity>
          </View>
        </View>
      </ImageBackground>
    </View>
  );
};

export default index;

Image 1

image-1

Image 2

image-2

@pedrohamarques
Copy link

I faced the same issue, as I posted on this thread: #628 (comment)

The solution I was provided is to update nativewind to 4.0.36 and it worked.

@saltxf
Copy link
Author

saltxf commented Apr 3, 2024

I faced the same issue, as I posted on this thread: #628 (comment)

The solution I was provided is to update nativewind to 4.0.36 and it worked.

I have updated to 4.0.36, but what happened was an error as follows. Previously, I was using 4.0.1 and there were no issues except for the Touchable Opacity where its className wasn't functioning properly.

tailwindcss(android) rebuilding... tailwindcss(android) is taking a long time to build, please read https://tailwindcss.com/docs/content-configuration#pattern-recommendations to speed up your build time
Error running TailwindCSS CLI, please run the CLI manually to see the error.Command used: node C:\Dev\React Native\weather\node_modules\tailwindcss\lib\cli.js --input "C:\Dev\React Native\weather\global.css" --output "C:\Dev\React Native\weather\node_modules.cache\nativewind\global.css.android.css" --watch

Have you ever experienced this when updating to 4.0.36? @pedrohamarques

@pedrohamarques
Copy link

I was running on a iOS device and didn't face this problem. Also, I run it on a Android 13 device and it worked properly.
Here's some log from my terminal (ignore the Babel line):

Using src/app as the root directory for Expo Router.
tailwindcss(ios) rebuilding... done
iOS Bundled 15855ms (C:\Users\pedro\Documents\GitHub\check-in-app\node_modules\expo-router\entry.js)
Using src/app as the root directory for Expo Router.
iOS Bundled 5218ms (C:\Users\pedro\Documents\GitHub\check-in-app\node_modules\expo-router\entry.js)
 Detected a change in babel.config.js. Restart the server to see the new results. You may need to clear the bundler cache with the --clear flag for your changes to take effect.
Using src/app as the root directory for Expo Router.
tailwindcss(android) rebuilding... done
Android Bundled 308089ms (C:\Users\pedro\Documents\GitHub\check-in-app\node_modules\expo-router\entry.js)

@mz-evia
Copy link

mz-evia commented Apr 5, 2024

@saltxf Maybe you need to update tailwind as well? And did you try to run the tailwind cli manually as suggested in the error?

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

No branches or pull requests

3 participants