Need help with solito setup for unistyles v2 🙏 #86
-
Hi there again @jpudysz , I'm using the latest command to create a solito starter project with expo-router:
Then I try to setup unistyles 2.0 ; I saw a sample that you have with the solito setup with unistyles v1, hence I think you are familiar with solito mono repo: This is what i did: In Then, in For nextjs, I realized the additional setup to add const { withExpo } = require('@expo/next-adapter')
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: false,
transpilePackages: [
'react-native',
'react-native-web',
'solito',
'dripsy',
'@dripsy/core',
'moti',
'app',
'react-native-reanimated',
'@expo/html-elements',
'react-native-gesture-handler',
'react-native-unistyles' // added
],
}
module.exports = withExpo(nextConfig) In import React from 'react'
import { View, Text } from 'react-native'
import { createStyleSheet, useStyles } from 'react-native-unistyles'
export function HomeScreen() {
const { styles } = useStyles(stylesheet)
return (
<View style={styles.container}>
<Text style={styles.text}>
Unistyles example
</Text>
</View>
)
}
const stylesheet = createStyleSheet(theme => ({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: theme.colors.background
},
text: {
color: theme.colors.typography
}
})) However, after building via EXPO DEV CLIENT I received this error: and when running the NEXTJS APP I received this error: I think they have something to do with both expo and nextjs apps not recognizing or finding the Thank you in advance for your help 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 14 replies
-
You need to also init To do that just import you config as always:
|
Beta Was this translation helpful? Give feedback.
-
Mentioned in my original post
Should i put it somewhere else ? @jpudysz |
Beta Was this translation helpful? Give feedback.
-
But apparently it works only for my NEXTJS portion of the app, my EXPO app via expo dev client still throwing The good news is that there is less flickering for the nextjs app as compared to the expo-web project using expo's create-expo-app ( Looking forward for your working demo, @jpudysz ; it's also working on expo dev client too right? Thanks, keep up the great work! Appreciate your work! |
Beta Was this translation helpful? Give feedback.
-
Thanks for updating the repo @jpudysz . The Nextjs portion of Solito is working fine now after putting the However, for the Expo portion of Solito, I tried to put ERROR Error: Unistyles runtime is not available. Make sure you followed the installation instructions, Still need help. Thanks! |
Beta Was this translation helpful? Give feedback.
Hello again 👋,
I've forked your repository and successfully run it on iOS without any additional code. You simply need to execute the
prebuild
command as mentioned here: https://reactnativeunistyles.vercel.app/start/setup/#2-finish-installation. To enable adaptive theming, you should activateuserInterfaceStyle
, as detailed in this link: https://reactnativeunistyles.vercel.app/reference/faq/#adaptive-mode-doesnt-work-for-me.Please note, if you execute
yarn native
from the root directory, it will attempt to start your app in Expo Go, which is no longer supported.