我是React Native的新手,并创建了一个带有三个按钮标签的页脚.我现在想知道如何通过单击按钮来呈现不同的屏幕.我的代码:
export default class Uptown extends Component {
render() {
return (
<Container>
<Header>
<Title>Uptown</Title>
</Header>
<Content>
<App />
</Content>
<Footer>
<FooterTab>
<Button>
Contact
</Button>
<Button>
Here
</Button>
<Button>
Me
</Button>
</FooterTab>
</Footer>
</Container>
);
}
}
Run Code Online (Sandbox Code Playgroud)
按下按钮时如何更改屏幕?
我试图在反应本机项目中实现react-native-navigation选项卡栏,虽然我一直收到错误:
'undefined不是一个对象(Evaluating RCCManager.setRootController)'.
我首先安装了react-native-navigation,然后是react-native-controllers,然后做了react-native链接(就像教程所说).
这是我的AppDelegate.m代码:
#import "AppDelegate.h"
#import "RCCManager.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSURL *jsCodeLocation;
jsCodeLocation = [[RCTBundleURLProvider sharedSettings]jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];
[[RCCManager sharedInstance] initBridgeWithBundleURL:jsCodeLocation];
return YES;
}
@end
Run Code Online (Sandbox Code Playgroud) 这是我第一次使用球拍,当我尝试评估 Dr. Racket 中的列表时,我收到一条错误消息(*:未绑定标识符;)。
#lang racket
(define (randop)
(define x(random 3))
(cond
((= x 0) '+)
((= x 1) '-)
((= x 2) '*)
)
)
(define (randexp ht)
(define x(random 10))
(define y(random 10))
(define z(randop))
(eval (list z y x))
)
(randexp 1)
Run Code Online (Sandbox Code Playgroud)
当在控制台中执行racket时,(eval lst)工作正常,尽管当我执行此代码时,它会出现一个未绑定的标识符。任何帮助表示赞赏。