기본 베이스는

 

https://reactnative.dev/docs/native-components-android#imageview-example

로 만들어서 

이미지 다운로드 부분은 

https://www.coderzheaven.com/2018/08/10/how-to-create-a-custom-native-imageview-in-android-for-reactnative/

 

를 이용하여 만들어봤다.

 

돌아는가게됏다...

 

안드로이드를 전혀 모르니 항상 뭔가 하려면 막혀서 힘들다


 

https://github.com/wiwi-git/ReactNativeUseAndroidUi

 

GitHub - wiwi-git/ReactNativeUseAndroidUi: rn에서 안드로이드에서 만든 ui가져오는 튜토리얼

rn에서 안드로이드에서 만든 ui가져오는 튜토리얼. Contribute to wiwi-git/ReactNativeUseAndroidUi development by creating an account on GitHub.

github.com

 

이후 웹뷰를 연결할거라 오픈이라 적힌 버튼이 있으나 중요한건 아니니 무시.

 

 

'React Native' 카테고리의 다른 글

rn fcm messaging error code 번역  (0) 2023.04.26
굳이 jsx를 사용하고싶다.  (0) 2022.01.05
UI Test를 위해 Detox를 적용해본다. -iOS  (0) 2021.12.15
npm install을 주의하라  (0) 2021.10.22
npm version downgrade  (0) 2021.07.12

패스워드용 텍스트필드를 만들려면 Secure설정을 주면 된다.

 

하지만 이렇게 하면 포커스가 옴겨졌다 다시 텍스트필드를 수정하려고하면 기존 텍스트 내용이 날라간다.

 

보안이 필요한 텍스트필드니 당연하다 생각했는데

 

이걸 원치 않는 사람이 있나보다

 

수정되는 이전 값이 남아 있고, 값이 숨기고 보이고 할 수 있고 그런 텍스트 필드를 원하는데 어떻게 해야할까요?

 

라는 질문을 글을 보고 이렇게 하면 되지 않을까 하고 해봤는데

 

솔직히 별로 맘에 안든다.

 

다른 방법이 없으려나

 

보안이 보안답지 않고....

그렇다고 소스가 깔끔하지도 않고....

 

나중에 텍스트필드를 새로 클래스 만들어서 하면 좀 깔끔해질거같긴한데 

미묘하다.

 

 

https://github.com/wiwi-git/Hide_And_Show_TextField

 

GitHub - wiwi-git/Hide_And_Show_TextField: 포커스 옴겨도 사라지지 않고 숨기고 보이고 할 수 있는 패스워

포커스 옴겨도 사라지지 않고 숨기고 보이고 할 수 있는 패스워드용 텍스트필드가 어떻게 만들까 생각하다 끄적여보는 레포지토리 - GitHub - wiwi-git/Hide_And_Show_TextField: 포커스 옴겨도 사라지지 않

github.com

 

var textField: UITextField!
    var showButton: UIButton!
    private var hiddenText: String = "" {
        didSet{
            print("hiddenText: " + hiddenText)
        }
    }
    var isShowMode = false
    
    let secretChar = "*"
    
    override func viewDidLoad() {
        super.viewDidLoad()
        textField = createTextField()
        showButton = createShowButton()

        view.addSubview(textField)
        view.addSubview(showButton)
        
        let viewGuide = view.safeAreaLayoutGuide
        textField.translatesAutoresizingMaskIntoConstraints = false
        showButton.translatesAutoresizingMaskIntoConstraints = false
        [
            textField.topAnchor.constraint(equalTo: viewGuide.topAnchor, constant: 30),
            textField.leadingAnchor.constraint(equalTo: viewGuide.leadingAnchor, constant: 16),
            textField.trailingAnchor.constraint(equalTo: viewGuide.trailingAnchor,constant: -16),
            textField.heightAnchor.constraint(equalToConstant: textField.frame.height),
            
            showButton.topAnchor.constraint(equalTo: textField.bottomAnchor, constant: 8),
            showButton.trailingAnchor.constraint(equalTo: viewGuide.trailingAnchor,constant: -16),
            showButton.heightAnchor.constraint(equalToConstant: textField.frame.height),
            showButton.widthAnchor.constraint(equalToConstant: 100)
        ].forEach { $0.isActive = true }
    }
    
    func createTextField() -> UITextField {
        let textFieldSize = CGSize(width: 0, height: 35)
        let textField = UITextField(frame: CGRect(origin: .zero, size: textFieldSize))
        textField.layer.borderWidth = 1
        textField.layer.cornerRadius = 10
        textField.textContentType = .password
        textField.placeholder = "password"
        textField.keyboardType = .asciiCapable
        textField.isSelected = false
        
        textField.addTarget(self, action: #selector(textFieldEditingChangedAction(_:)), for: .editingChanged)
        return textField
    }

    func createShowButton() -> UIButton {
        let showButton = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 100, height: 35)))
        showButton.setTitle("Set Show", for: .normal)
        showButton.setTitleColor(.systemBlue, for: .normal)
        showButton.backgroundColor = .clear
        showButton.setBackgroundImage(nil, for: .normal)
        showButton.layer.borderWidth = 1
        showButton.layer.borderColor = UIColor.systemBlue.cgColor
        showButton.layer.cornerRadius = 10
        showButton.addTarget(self, action: #selector(showButtonAction(_:)), for: .touchUpInside)
        
        return showButton
    }
    
    @objc func showButtonAction(_ sender: UIButton) {
        if ( sender.titleLabel?.text == "Set Show") {
            self.isShowMode = true
            sender.setTitle("Set Hide", for: .normal)
            sender.layer.borderColor = UIColor.clear.cgColor
            sender.backgroundColor = .darkGray
            sender.setTitleColor(.white, for: .normal)
            
            self.textField.text = hiddenText
            
        } else {
            self.isShowMode = false
            sender.setTitle("Set Show", for: .normal)
            sender.setTitleColor(.systemBlue, for: .normal)
            sender.backgroundColor = .clear
            sender.layer.borderColor = UIColor.systemBlue.cgColor
            
            textField.text = ""
            hiddenText.forEach { _ in
                textField.text! += secretChar
            }
        }
    }
    
    @objc func textFieldEditingChangedAction(_ textField: UITextField) {
        guard let last = textField.text?.last else {
            hiddenText = ""
            return
        }
        
        if textField.text?.count ?? 0 > hiddenText.count {
            if (!isShowMode) {
                textField.text?.removeLast()
                textField.text! += secretChar
            }
            hiddenText += String(last)
        } else {
            hiddenText.removeLast()
        }
    }

https://stackoverflow.com/questions/54461288/installation-failed-with-message-error-android-os-parcelableexception-java-io

 

Installation failed with message Error: android.os.ParcelableException: java.io.IOException: Requested internal only, but not en

I was getting the message > Installation failed with message Failed to establish session. so following some responses to the problem I disabled Instant Run and I started getting > Install...

stackoverflow.com

 

 

설치하려던 곳의 용량이 부족하다.

설치된 앱 용량을 살펴보고 

용량을 확보하자.

fatal: Unable to create ~~~~ 
fatal: Unable to create '~~~~ /.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.'~~~~ .git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

 

 

 

소스트리를 사용하는데 커밋이 안된다.

 

뭔가 다른 프로그램에서 깃연동된것때문에 충돌이 됐나보다

 

.git/index.lock 파일을 삭제하니 동작한다

 

 

'메모' 카테고리의 다른 글

링크 NestJS로 배우는 백엔드 프로그래밍  (0) 2022.03.30
Decodeable ????????????????????????????????????  (0) 2022.03.21
RIBs  (0) 2021.12.28
단어저장용2  (0) 2020.04.14
저장용...  (0) 2020.04.14

Attempted to scroll the collection view to an out-of-bounds item (0) when there are only 0 items in section 0.

 

늦은 업데이트를 진행하였고 시뮬레이터가 15.2가 되었다.

회사 프로젝트를 돌려보던중 시뮬레이터에서 위와 같은 에러가 나면서 종료가 되고있다.

 

내용만 봐선 "아이템이 0인데 스크롤을 0으로 하려고한다 그러지마 "  라며 친절히 문제되는 부분을 알려주지만

 

이전에는 됐는데?

 

참담한 심정으로 콜렉션뷰의 스크롤하는 부분

      self.collectionView.scrollToItem

부분을

if (.count != 0 ) 를 걸어주어 0 이후에 변경될때만 호출해주도록 변경하였다.

 

동작은 한다

 

뭔가 미묘한 기분

https://stackoverflow.com/a/26575808/12803800

 

Square layout on GridLayoutManager for RecyclerView

I try to make a grid-layout with square images. I thought that it must be possible to manipulate the GridLayoutManager by manipulating onMeasure to do a super.onMeasure(recycler, state, widthSpec,

stackoverflow.com

 

어쩌다 이러고 있는지 모르겠지만

안드로이드 앱을 작성하고있습니다.

뭐가 뭔지 하나도 모르고 

책도 한권없는 상태라 막막해서 주먹구구식으로 이런게 필요하겠지 라면서 

iOS 짜듯이 짜보고 있는데

도저히 RecyclerView의 GridLayoutManager를 넣었을때 정사각형으로 나오질 않아 다 집어 던지고 도망가고 싶어질때쯤

이러한걸 만들어주시는 고마운분을 발견해 이렇게 글을 씁니다.

 

고마워요...

'Android' 카테고리의 다른 글

Installation failed with message Failed to establish session.  (0) 2022.02.11

https://www.viget.com/articles/animated-ios-launch-screen/

 

Animate Your iOS Splash Screen | Viget

Learn how to animate iOS launch screens however you want!

www.viget.com

 

https://github.com/raywenderlich/swift-algorithm-club

+ Recent posts