
just i uses the "WithObservables" in one Component
this is my package:
"dependencies": {
"@nozbe/watermelondb": "^0.15.0",
"@nozbe/with-observables": "^1.0.5",
"@react-native-community/masked-view": "^0.1.6",
"@react-navigation/bottom-tabs": "^5.0.5",
"@react-navigation/native": "^5.0.3",
"@react-navigation/stack": "^5.0.3",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-gesture-handler": "^1.5.6",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.0.0-beta.2",
"recompose": "^0.30.0"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"@types/jest": "^24.0.24",
"@types/react-native": "^0.60.25",
"@types/react-test-renderer": "16.9.1",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.12.0",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0",
"typescript": "^3.7.3"
this is the component where i use
import React from 'react'
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
import withObservables from '@nozbe/with-observables'
type homeProps = {
database?: any,
user?: any,
name?: string,
Mensaje?: string
}
function Home(props: homeProps) {
console.log(Componente home ${props.Mensaje})
return (
Holaaaaa
{props.name}
{props.Mensaje}
)
}
const enhance = withObservables(['Mensaje'], ({ Mensaje }) => {
Mensaje
})
const EnhancedHome = enhance(Home)
export default EnhancedHome;
Really pls HelpMe
Regards
The return value of second parameter should be object containing observables / Query / Promise in its values.
One mistake I see is that you need to wrap the return object in round brackets () 馃憞
const enhance = withObservables(['Mensaje'], ({ Mensaje }) => ({
Mensaje
}))
Also is Mensaje a Model or string? Your proptypes suggest that Mensaje?: string which might be the problem.
I am getting this error as well when trying to make multiple observations in one component. Digging into with-observables.cjs.js (line 53) combineLatest is undefined (it skips combineLatest when only one prop is observed).
This seems related to the breaking import changes to rxjs multiple people seem to be having (refer to PR #66 in with-observables: https://github.com/Nozbe/withObservables/pull/66
@coreyRalli I guess that is why the example composes multiple withObservables:
Which should not be required, withObservables should allow multiple observations in one component.
Though I'm not getting this error. If you are using yarn, can you share the entries related to rxjs and rxjs-compat:
Mine are:
rxjs-compat@^6.3.2:
version "6.5.4"
resolved "https://registry.yarnpkg.com/rxjs-compat/-/rxjs-compat-6.5.4.tgz#03825692af3fe363e04c43f41ff4113d76bbd305"
integrity sha512-rkn+lbOHUQOurdd74J/hjmDsG9nFx0z66fvnbs8M95nrtKvNqCKdk7iZqdY51CGmDemTQk+kUPy4s8HVOHtkfA==
rxjs@^6.1.0, rxjs@^6.2.2, rxjs@^6.3.3, rxjs@^6.4.0:
version "6.5.4"
resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c"
integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==
dependencies:
tslib "^1.9.0"
Just created a blank project using yarn now and it works as expected! I'm a tad stumped as to why as I pulled down the packages (using npm) two days ago 馃槼
Just created a blank project using yarn now and it works as expected! I'm a tad stumped as to why as I pulled down the packages (using npm) two days ago 馃槼
hi again. the blank project have created.. it's with typescript??.. i'm using that template for react-native.
now i'm going to install yarn to try run the project.
ragards.
Hi again.
Works!!. just i tried over and over again. I was using it wrong the "WithObservable"
thanks a lot
regards!
Most helpful comment
I am getting this error as well when trying to make multiple observations in one component. Digging into with-observables.cjs.js (line 53) combineLatest is undefined (it skips combineLatest when only one prop is observed).
This seems related to the breaking import changes to rxjs multiple people seem to be having (refer to PR #66 in with-observables: https://github.com/Nozbe/withObservables/pull/66